sherzberg / graylog-plugin-s3

Apache License 2.0
16 stars 11 forks source link

Handle more s3 events other than CreateObject #6

Open sherzberg opened 7 years ago

sherzberg commented 7 years ago

http://docs.aws.amazon.com/AmazonS3/latest/dev/notification-con

Currently we probably only support ObjectCreate events (this is all I use at the moment). But we also do not support the TestEvent, which is a problem when you first setup graylog.

2017-08-22T17:58:19.584Z ERROR [S3SNSNotificationParser] Could not parse SNS notification: {
  "Type" : "Notification",
  "MessageId" : "72c31657-826c-5d8b-bd23-4441ec170390",
  "TopicArn" : "arn:aws:sns:us-west-2:XXXXXXXXXXXX:myapp-cloudfront-logs-events",
  "Subject" : "Amazon S3 Notification",
  "Message" : "{\"Service\":\"Amazon S3\",\"Event\":\"s3:TestEvent\",\"Time\":\"2017-08-22T17:39:07.052Z\",\"Bucket\":\"myapp-cloudfront\",\"RequestId\":\"XXXXXXXXXXXXXXXX\",\"HostId\":\"8+rwHIOkZTgJ7ELo9TU
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=\"}",
  "Timestamp" : "2017-08-22T17:39:07.927Z",
  "SignatureVersion" : "1",
  "Signature" : "LONGSIG",
  "SigningCertURL" : "https://sns.us-west-2.amazonaws.com/SimpleNotificationService-XXXX.pem",
  "UnsubscribeURL" : "https://sns.us-west-2.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-west-2:XXXXXXXXXXXX:myapp-cloudfront-logs-events:471447cf-c89d-4d19-b56e-XXXXXXXXXXXX"
}
java.lang.NullPointerException: null
        at org.sherzberg.graylog.aws.inputs.s3.notifications.S3SNSNotificationParser.parse(S3SNSNotificationParser.java:35) [graylog-plugin-s3.jar:?]
        at org.sherzberg.graylog.aws.inputs.s3.notifications.S3SQSClient.getNotifications(S3SQSClient.java:55) [graylog-plugin-s3.jar:?]
        at org.sherzberg.graylog.aws.inputs.s3.S3Subscriber$Processor.run(S3Subscriber.java:82) [graylog-plugin-s3.jar:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_121]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_121]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_121]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:1.8.0_121]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_121]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_121]
        at java.lang.Thread.run(Thread.java:745) [?:1.8.0_121]