Class: Fluent::Plugin::InsertIdFilter
- Inherits:
-
Filter
- Object
- Filter
- Fluent::Plugin::InsertIdFilter
- Includes:
- selfself::ConfigConstants
- Defined in:
- lib/fluent/plugin/filter_insert_id.rb
Defined Under Namespace
Modules: ConfigConstants
Instance Attribute Summary collapse
-
#insert_id_key ⇒ Object
readonly
Expose attr_readers for testing.
Instance Method Summary collapse
Instance Attribute Details
#insert_id_key ⇒ Object (readonly)
Expose attr_readers for testing.
51 52 53 |
# File 'lib/fluent/plugin/filter_insert_id.rb', line 51 def insert_id_key @insert_id_key end |
Instance Method Details
#configure(conf) ⇒ Object
53 54 55 |
# File 'lib/fluent/plugin/filter_insert_id.rb', line 53 def configure(conf) super end |
#filter(tag, time, record) ⇒ Object
69 70 71 72 73 74 75 76 |
# File 'lib/fluent/plugin/filter_insert_id.rb', line 69 def filter(tag, time, record) # Only generate and add an insertId field if the record is a hash and # the insert ID field is not already set (or set to an empty string). if record.is_a?(Hash) && record[@insert_id_key].to_s.empty? record[@insert_id_key] = increment_insert_id end record end |
#shutdown ⇒ Object
65 66 67 |
# File 'lib/fluent/plugin/filter_insert_id.rb', line 65 def shutdown super end |
#start ⇒ Object
57 58 59 60 61 62 63 |
# File 'lib/fluent/plugin/filter_insert_id.rb', line 57 def start super # Initialize the ID log.info "Started the insert-id plugin with #{@insert_id_key} as the insert ID key." @insert_id = generate_initial_insert_id log.info "Initialized the insert ID key to #{@insert_id}." end |