Class: Fluent::Plugin::JqTransformerFilter

Inherits:
Filter
  • Object
show all
Includes:
JqMixin
Defined in:
lib/fluent/plugin/filter_jq_transformer.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

#filter(tag, time, record) ⇒ Object



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

def filter(tag, time, record)
	new_record = jq_transform tag: tag, time: time, record: record
	return new_record if new_record.is_a?(Hash)

	log.error "jq filter #{@jq} did not return a hash, skip this record."
	nil
rescue JqError
	log.error "Filter failed with #{@jq}#{log.on_debug { ' on ' + MultiJson.dump(tag: tag, time: time, record: record) }}, error: #{$!.message}"
	nil
end