Skip to content

Instantly share code, notes, and snippets.

@murilobsd
Forked from pahud/delete_all_awslogs.sh.md
Created December 12, 2019 17:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save murilobsd/ac948adf908d4cfabf088808e7ce593d to your computer and use it in GitHub Desktop.
Save murilobsd/ac948adf908d4cfabf088808e7ce593d to your computer and use it in GitHub Desktop.
delete all aws log groups

specify the region

export AWS_DEFAULT_REGION=ap-northeast-1
aws logs describe-log-groups --query 'logGroups[*].logGroupName' --output table | \
awk '{print $2}' | grep -v ^$ | while read x; do  echo "deleting $x" ; aws logs delete-log-group --log-group-name $x; done

only delete loggroup name starting with /aws/lambda

export AWS_DEFAULT_REGION=ap-northeast-1
aws logs describe-log-groups --query 'logGroups[*].logGroupName' --output table | \
awk '{print $2}' | grep ^/aws/lambda | while read x; do  echo "deleting $x" ; aws logs delete-log-group --log-group-name $x; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment