Skip to content

Instantly share code, notes, and snippets.

@dannenberg
Created June 12, 2017 21:24
Show Gist options
  • Save dannenberg/1d09f00afea5869a8ca72d98df1bd833 to your computer and use it in GitHub Desktop.
Save dannenberg/1d09f00afea5869a8ca72d98df1bd833 to your computer and use it in GitHub Desktop.
echo "buckets logging to a folder other than <theirname>/:"
for bucket in $(aws s3 ls | awk '{print $3}')
do
bucket_status=$(aws s3api get-bucket-logging --bucket $bucket | grep -v "$bucket/")
if [[ $bucket_status != "" ]]; then
echo "\t$bucket"
fi
done
echo "buckets logging to a bucket other than s3.bucket.access.logs:"
for bucket in $(aws s3 ls | awk '{print $3}')
do
bucket_status=$(aws s3api get-bucket-logging --bucket $bucket | grep -v 's3.bucket.access.logs')
if [[ $bucket_status != "" ]]; then
echo "\t$bucket"
fi
done
echo "buckets without logging:"
for bucket in $(aws s3 ls | awk '{print $3}')
do
bucket_status=$(aws s3api get-bucket-logging --bucket $bucket)
if [[ $bucket_status == "" ]]; then
echo "\t$bucket"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment