Created
January 29, 2019 10:04
-
-
Save grncdr/b80a698507c4dc981995fcb6df3beeeb to your computer and use it in GitHub Desktop.
One liner for setting retention policy on a set of cloudwatch log groups
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
PATTERN="my-app-production" | |
RETENTION_IN_DAYS="30" | |
for group_name in $(aws logs describe-log-groups | jq -r '.logGroups[]|.logGroupName' | grep $PATTERN); do | |
aws logs put-retention-policy --log-group-name $group_name --retention-in-days $RETENTION_IN_DAYS; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment