Sha256: 8fbae49ab92da1b1320e22334047a7c0cf444eb6bed7e25d6431f926c144aba7

Contents?: true

Size: 697 Bytes

Versions: 1

Compression:

Stored size: 697 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"
  milestone 1

  # 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

1 entries across 1 versions & 1 rubygems

Version Path
logstash-lib-1.3.2 lib/logstash/filters/environment.rb