lib/fluent/plugin/in_sqs.rb in fluent-plugin-aws-sqs-1.0.7 vs lib/fluent/plugin/in_sqs.rb in fluent-plugin-aws-sqs-1.0.8
- old
+ new
@@ -16,10 +16,11 @@
config_param :max_number_of_messages, :integer, default: 10
config_param :wait_time_seconds, :integer, default: 10
config_param :visibility_timeout, :integer, default: nil
config_param :delete_message, :bool, default: false
config_param :stub_responses, :bool, default: false
+ config_param :attribute_name_to_extract, :string, default: nil
def configure(conf)
super
if @tag == nil
@@ -71,16 +72,21 @@
log.error 'failed to emit or receive', error: ex.to_s, error_class: ex.class
log.warn_backtrace ex.backtrace
end
def parse_message(message)
- {
+ record = {
'body' => message.body.to_s,
'receipt_handle' => message.receipt_handle.to_s,
'message_id' => message.message_id.to_s,
'md5_of_body' => message.md5_of_body.to_s,
- 'queue_url' => message.queue_url.to_s,
- 'sender_id' => message.attributes['SenderId'].to_s
+ 'queue_url' => message.queue_url.to_s
}
+
+ if @attribute_name_to_extract.to_s.strip.length > 0
+ record[@attribute_name_to_extract] = message.attributes[attribute_name_to_extract].to_s
+ end
+
+ record
end
end
end