Class: Fluent::Plugin::AwsEventBridgeOutput

Inherits:
Output
  • Object
show all
Defined in:
lib/fluent/plugin/out_eventbridge.rb

Instance Method Summary collapse

Instance Method Details

#configure(conf) ⇒ Object



87
88
89
# File 'lib/fluent/plugin/out_eventbridge.rb', line 87

def configure(conf)
  super
end

#process(_tag, es) ⇒ Object



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/fluent/plugin/out_eventbridge.rb', line 97

def process(_tag, es)
  es.each_slice(@batch_size) do |_batch|
    es.each do |_time, record|
      source = record[@source_key]
      detail_type = record[@detail_type_key]
      event_time = record[@time_key] ? Time.parse(record[@time_key]) : Time.now

      event_params = {
        source: source,
        detail_type: detail_type,
        time: event_time,
        detail: record.to_json
      }

      send_event_to_eventbridge(event_params)
    end
  end
end

#startObject



91
92
93
94
95
# File 'lib/fluent/plugin/out_eventbridge.rb', line 91

def start
  options = setup_credentials
  @eventbridge = Aws::EventBridge::Client.new(options)
  super
end