Class: Fluent::Plugin::FormatDruidAuditLog1Filter
- Inherits:
-
Filter
- Object
- Filter
- Fluent::Plugin::FormatDruidAuditLog1Filter
- Defined in:
- lib/fluent/plugin/filter_format_druid_audit_log_1.rb
Constant Summary collapse
- NAME =
'format_druid_audit_log_1'- DEFAULT_QUERY_KEY =
'query'
Instance Method Summary collapse
- #configure(conf) ⇒ Object
- #filter(_tag, _time, record) ⇒ Object
- #guess_query_type(record) ⇒ Object
- #multi_workers_ready? ⇒ Boolean
Instance Method Details
#configure(conf) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/fluent/plugin/filter_format_druid_audit_log_1.rb', line 18 def configure(conf) super return unless query_key.nil? raise Fluent::ConfigError, 'query_key should be specified' end |
#filter(_tag, _time, record) ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/fluent/plugin/filter_format_druid_audit_log_1.rb', line 30 def filter(_tag, _time, record) query_type = guess_query_type(record) new_record = record.except(query_key) new_record['query_type'] = query_type new_record["#{query_type}_query".downcase] = record[query_key] new_record end |
#guess_query_type(record) ⇒ Object
39 40 41 42 43 44 |
# File 'lib/fluent/plugin/filter_format_druid_audit_log_1.rb', line 39 def guess_query_type(record) record.dig(query_key, 'queryType') || (record.dig('query_result', 'sqlQuery/time') && 'sql') || (record.dig(query_key, 'query') && 'sql') || 'unknown' end |
#multi_workers_ready? ⇒ Boolean
26 27 28 |
# File 'lib/fluent/plugin/filter_format_druid_audit_log_1.rb', line 26 def multi_workers_ready? true end |