Skip to content

Instantly share code, notes, and snippets.

@grncdr
Created January 29, 2019 10:04
Show Gist options
  • Save grncdr/b80a698507c4dc981995fcb6df3beeeb to your computer and use it in GitHub Desktop.
Save grncdr/b80a698507c4dc981995fcb6df3beeeb to your computer and use it in GitHub Desktop.

Revisions

  1. grncdr created this gist Jan 29, 2019.
    8 changes: 8 additions & 0 deletions set-retention-policies.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    #!/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