class Fluent::Plugin::MssqlLookupFilter
Public Class Methods
new()
click to toggle source
Calls superclass method
# File lib/fluent/plugin/filter_mssql_lookup.rb, line 36 def initialize super @lookup = Hash.new end
Public Instance Methods
filter(tag, time, record)
click to toggle source
# File lib/fluent/plugin/filter_mssql_lookup.rb, line 60 def filter(tag, time, record) id = record[@key] return record if id.nil? upid = id.upcase match = @lookup[upid] return record if match.nil? match.each do |key,val| next if key == @lookup_key name = key.downcase record[name] = val end return record end
lookup_refresh()
click to toggle source
# File lib/fluent/plugin/filter_mssql_lookup.rb, line 51 def lookup_refresh client = TinyTds::Client.new username: @db_user, password: @db_password, host: @db_host, port: @db_port, database: @db_name results = client.execute(@lookup_sql) results.each do |row| id = row[@lookup_key] @lookup[id] = row end end
start()
click to toggle source
Calls superclass method
# File lib/fluent/plugin/filter_mssql_lookup.rb, line 42 def start super lookup_refresh timer_execute(:refresh_timer, @lookup_interval) do lookup_refresh end end