I want to log the events when I download any file from download folder, if I download file from any other folder say upload then it should not log that event.
I'm using the below code in cloud shell:
aws cloudtrail put-event-selectors --trail-name name \
--advanced-event-selectors \
'[
{
"Name": "S3EventSelector",
"FieldSelectors": [
{ "Field": "eventCategory", "Equals": ["Data"] },
{ "Field": "resources.type", "Equals": ["AWS::S3::Object"] },
{"Field": "eventName", "Equals":["GetObject"]},
{ "Field": "resources.ARN", "StartsWith": ["arn:aws:s3:::bucket/"] }
]
}
]'
Here, I'm getting the logs from every folder if I download any file.