Skip to content

Commit 39c517c

Browse files
committed
Add assume_sns option
Add support for SQS messages arriving via SNS. This is commonly used to fan out S3 events. Because SNS wraps the messages, we need to dive one layer deeper into the SQS body. Signed-off-by: Corry Haines <[email protected]>
1 parent bf1cdcf commit 39c517c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/fluent/plugin/in_s3.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ def initialize
104104
config_param :wait_time_seconds, :integer, default: 20
105105
desc "Polling error retry interval."
106106
config_param :retry_error_interval, :integer, default: 300
107+
desc "Assume messages as SNS notifications"
108+
config_param :assume_sns, :bool, default: false
107109
end
108110

109111
desc "Tag string"
@@ -182,6 +184,10 @@ def run
182184
begin
183185
body = Yajl.load(message.body)
184186
log.debug(body)
187+
if @assume_sns
188+
next unless body["Message"]
189+
body = Yajl.load(body["Message"])
190+
end
185191
next unless body["Records"] # skip test queue
186192

187193
process(body)

0 commit comments

Comments
 (0)