Sha256: ffb7152987a86c71bf9bc63afc3737a25698843086c2abec7fbd62b530f6f3c0

Contents?: true

Size: 585 Bytes

Versions: 4

Compression:

Stored size: 585 Bytes

Contents

require "logstash/devutils/rspec/spec_helper"
require "logstash/filters/environment"

describe LogStash::Filters::Environment do
  before do
    ENV["MY_ENV_VAR"] = "hello world"
  end

  describe "add a field from the environment" do
    # The logstash config goes here.
    # At this time, only filters are supported.
    config <<-CONFIG
      filter {
        environment {
          add_metadata_from_env => [ "newfield", "MY_ENV_VAR" ]
        }
      }
    CONFIG

    sample "example" do
      insist { subject.get("[@metadata][newfield]") } == "hello world"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
logstash-filter-environment-3.0.3 spec/filters/environment_spec.rb
logstash-filter-environment-3.0.2 spec/filters/environment_spec.rb
logstash-filter-environment-3.0.1 spec/filters/environment_spec.rb
logstash-filter-environment-3.0.0 spec/filters/environment_spec.rb