Class: LogStash::Filters::Environment

Inherits:
Base
  • Object
show all
Defined in:
lib/logstash/filters/environment.rb

Overview

Set fields from environment variables

Constant Summary

Constants inherited from Base

Base::RESERVED

Constants included from Config::Mixin

Config::Mixin::CONFIGSORT

Instance Attribute Summary

Attributes included from Config::Mixin

#config, #original_params

Attributes inherited from Plugin

#logger, #params

Instance Method Summary collapse

Methods inherited from Base

#execute, #initialize, #threadsafe?

Methods included from Config::Mixin

#config_init, included

Methods inherited from Plugin

#eql?, #finished, #finished?, #hash, #initialize, #inspect, lookup, #reload, #running?, #shutdown, #teardown, #terminating?, #to_s

Constructor Details

This class inherits a constructor from LogStash::Filters::Base

Instance Method Details

#filter(event) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/logstash/filters/environment.rb', line 20

def filter(event)
  return unless filter?(event)
  @add_field_from_env.each do |field, env|
    event[field] = ENV[env]
  end
  filter_matched(event)
end

#registerObject



15
16
17
# File 'lib/logstash/filters/environment.rb', line 15

def register
  # Nothing
end