Sha256: 38e2ec77f23eba25e30218014fc3534e5f1dade58829d4b5f073ecb521525175

Contents?: true

Size: 686 Bytes

Versions: 3

Compression:

Stored size: 686 Bytes

Contents

# encoding: utf-8
require "logstash/filters/base"
require "logstash/namespace"


# Set fields from environment variables
class LogStash::Filters::Environment < LogStash::Filters::Base
  config_name "environment"

  # Specify a hash of fields to the environment variable
  # A hash of matches of `field => environment` variable
  config :add_field_from_env, :validate => :hash, :default => {}

  public
  def register
    # Nothing
  end # def register

  public
  def filter(event)
    return unless filter?(event)
    @add_field_from_env.each do |field, env|
      event[field] = ENV[env]
    end
    filter_matched(event)
  end # def filter
end # class LogStash::Filters::Environment

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
logstash-filter-environment-0.1.5 lib/logstash/filters/environment.rb
logstash-filter-environment-0.1.4 lib/logstash/filters/environment.rb
logstash-filter-environment-0.1.3 lib/logstash/filters/environment.rb