Collect S3 Application Logs
Prerequisites
Amazon S3 Setup
2
Modify the SQS Queue Policy to Allow S3 to Send Messages
{
"Version": "2012-10-17",
"Id": "S3ToSQSPolicy",
"Statement": [
{
"Sid": "AllowS3Bucket",
"Effect": "Allow",
"Principal": {
"Service": "s3.amazonaws.com"
},
"Action": "SQS:SendMessage",
"Resource": "arn:aws:sqs:<region>:<account-id>:<queue-name>",
"Condition": {
"ArnLike": {
"aws:SourceArn": "arn:aws:s3:::<bucket-name>"
},
"StringEquals": {
"aws:SourceAccount": "<account-id>"
}
}
}
]
}3
S3 Event Notification Rules for Logs
{
"QueueConfigurations": [
{
"Id": "CloudWatchLogNotification",
"QueueArn": "arn:aws:sqs:<region>:<account-id>:<queue-name>",
"Events": ["s3:ObjectCreated:*"],
"Filter": {
"Key": {
"FilterRules": [
{
"Name": "prefix",
"Value": "cloudwatch-logs/"
},
{
"Name": "suffix",
"Value": ".log"
}
]
}
}
}
]
}{
"QueueConfigurations": [
{
"Id": "CloudTrailLogNotification",
"QueueArn": "arn:aws:sqs:<region>:<account-id>:<queue-name>",
"Events": ["s3:ObjectCreated:*"],
"Filter": {
"Key": {
"FilterRules": [
{
"Name": "prefix",
"Value": "AWSLogs/"
},
{
"Name": "suffix",
"Value": ".json.gz"
}
]
}
}
}
]
}{
"QueueConfigurations": [
{
"Id": "WAFLogNotification",
"QueueArn": "arn:aws:sqs:<region>:<account-id>:<queue-name>",
"Events": ["s3:ObjectCreated:*"],
"Filter": {
"Key": {
"FilterRules": [
{
"Name": "prefix",
"Value": "aws-waf-logs/"
},
{
"Name": "suffix",
"Value": ".gz"
}
]
}
}
}
]
}Onum Setup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Last updated
Was this helpful?

