Class: Fluent::Plugin::JqFormatter
- Inherits:
-
Formatter
- Object
- Formatter
- Fluent::Plugin::JqFormatter
- Includes:
- JqMixin
- Defined in:
- lib/fluent/plugin/formatter_jq.rb
Constant Summary
Constants included from JqMixin
Instance Method Summary collapse
- #format(tag, time, record) ⇒ Object
-
#initialize ⇒ JqFormatter
constructor
A new instance of JqFormatter.
Methods included from JqMixin
#configure, included, #jq_transform, #shutdown, #start, #start_process
Constructor Details
#initialize ⇒ JqFormatter
Returns a new instance of JqFormatter.
32 33 34 |
# File 'lib/fluent/plugin/formatter_jq.rb', line 32 def initialize super end |
Instance Method Details
#format(tag, time, record) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/fluent/plugin/formatter_jq.rb', line 36 def format(tag, time, record) item = jq_transform record if item.instance_of?(String) item else MultiJson.dump item end rescue JqError msg = "Format failed with #{@jq}#{log.on_debug { ' on ' + MultiJson.dump(record) }}, error: #{$!.}" log.error msg case @on_error when :skip return '' when :ignore return MultiJson.dump(record) when :raise_error raise msg end end |