Class: LogStash::Outputs::Cassandra::EventParser
- Inherits:
-
Object
- Object
- LogStash::Outputs::Cassandra::EventParser
- Defined in:
- lib/logstash/outputs/cassandra/event_parser.rb
Overview
Responsible for accepting events from the pipeline and returning actions for the SafeSubmitter
Instance Method Summary collapse
-
#initialize(options) ⇒ EventParser
constructor
A new instance of EventParser.
- #parse(event) ⇒ Object
Constructor Details
#initialize(options) ⇒ EventParser
Returns a new instance of EventParser.
8 9 10 11 12 13 14 15 16 |
# File 'lib/logstash/outputs/cassandra/event_parser.rb', line 8 def initialize() @logger = ['logger'] @table = ['table'] @filter_transform_event_key = ['filter_transform_event_key'] assert_filter_transform_structure(['filter_transform']) if ['filter_transform'] @filter_transform = ['filter_transform'] @hints = ['hints'] @ignore_bad_values = ['ignore_bad_values'] end |
Instance Method Details
#parse(event) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/logstash/outputs/cassandra/event_parser.rb', line 18 def parse(event) action = {} begin action['table'] = event.sprintf(@table) filter_transform = get_filter_transform(event) if filter_transform action['data'] = {} filter_transform.each { |filter| add_event_value_from_filter_to_action(event, filter, action) } else add_event_data_using_configured_hints(event, action) end @logger.debug('event parsed to action', :action => action) rescue Exception => e @logger.error('failed parsing event', :event => event, :error => e) action = nil end action end |