class Fluent::Plugin::TwistlockSyslogFilter
Public Instance Methods
configure(conf)
click to toggle source
Calls superclass method
# File lib/fluent/plugin/filter_twistlock_syslog.rb, line 11 def configure(conf) super unless File.file?(@key_path) raise Fluent::ConfigError, "Private key file must be present. #{@key_path} Please check." end end
filter(tag, time, record)
click to toggle source
# File lib/fluent/plugin/filter_twistlock_syslog.rb, line 21 def filter(tag, time, record) message = record[@key_name][0..-2] begin message.split(/(?<!\\|=)"\s/).each { |in_msg| keymap = in_msg.split('="') record[keymap[0]] = keymap[1] } record.delete("ident") record.delete("pid") record.delete("time") if record.key?("host_name") record["host"] = record["host_name"] record.delete("host_name") end signature = @private_key.sign(OpenSSL::Digest::SHA256.new, record[@key_name]) record['checksum_signature'] = Base64.encode64(signature) rescue Exception => e log.warn "Unable to map record with message=#{record[@key_name]}" log.warn e.backtrace.inspect end record end
start()
click to toggle source
Calls superclass method
# File lib/fluent/plugin/filter_twistlock_syslog.rb, line 17 def start super @private_key = OpenSSL::PKey::RSA.new(File.read(@key_path)) end