Class: Fluent::Plugin::JqParser

Inherits:
Parser
  • Object
show all
Includes:
JqMixin
Defined in:
lib/fluent/plugin/parser_jq.rb

Constant Summary

Constants included from JqMixin

JqMixin::JqError

Instance Method Summary collapse

Methods included from JqMixin

#configure, included, #jq_transform, #shutdown, #start, #start_process

Instance Method Details

#parse(text) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/fluent/plugin/parser_jq.rb', line 29

def parse(text)
  record = jq_transform text
  if record.is_a?(Hash)
    yield parse_time(record), record
  else
    log.error "jq filter #{@jq} did not return a hash, skip this record."
  end
rescue JqError
  log.error "Parse failed with #{@jq}#{log.on_debug {' on ' + text}}, error: #{$!.message}"
  nil
end