Class: Fluent::ViaqDockerAuditParser
- Inherits:
-
Parser
- Object
- Parser
- Fluent::ViaqDockerAuditParser
- Defined in:
- lib/fluent/plugin/parser_viaq_docker_audit.rb
Instance Method Summary collapse
Instance Method Details
#configure(conf = {}) ⇒ Object
9 10 11 12 |
# File 'lib/fluent/plugin/parser_viaq_docker_audit.rb', line 9 def configure(conf={}) super @audit_parser = ViaqDockerAudit.new() end |
#parse(text) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/fluent/plugin/parser_viaq_docker_audit.rb', line 14 def parse(text) begin parsed_line = @audit_parser.parse_audit_line text time = parsed_line.nil? ? Time.now.to_f : DateTime.parse(parsed_line['time']).to_time.to_f # All other logs than virt-control should be ignored. # Since this plugin is tailored specifically to atomic-project # docker audit log, it can not properly parse those. # A temporary solution is to mark unwanted messages as something # that is easy to find and exclude by the fluentd grep plugin. parsed_line = {"virt-control" => "false"} if parsed_line.nil? yield time, parsed_line rescue Fluent::ViaqDockerAudit::ViaqDockerAuditParserException => e log.error e. yield nil, nil end end |