Skip to content

Instantly share code, notes, and snippets.

@Selimcse98
Forked from pahud/delete_all_awslogs.sh.md
Created November 20, 2020 01:53
Show Gist options
  • Save Selimcse98/94bae73b25250af0f9ab8bf5c5895e9f to your computer and use it in GitHub Desktop.
Save Selimcse98/94bae73b25250af0f9ab8bf5c5895e9f to your computer and use it in GitHub Desktop.

Revisions

  1. @pahud pahud revised this gist Oct 14, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion delete_all_awslogs.sh.md
    Original file line number Diff line number Diff line change
    @@ -11,5 +11,5 @@ awk '{print $2}' | grep -v ^$ | while read x; do echo "deleting $x" ; aws logs
    ```sh
    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
    awk '{print $2}' | grep ^/aws/lambda | while read x; do echo "deleting $x" ; aws logs delete-log-group --log-group-name $x; done
    ```
  2. @pahud pahud revised this gist Oct 14, 2019. 1 changed file with 12 additions and 1 deletion.
    13 changes: 12 additions & 1 deletion delete_all_awslogs.sh.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,15 @@
    # specify the region

    ```sh
    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 aws logs delete-log-group --log-group-name $x; done
    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

    ```sh
    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
    ```
  3. @pahud pahud revised this gist Oct 14, 2019. 2 changed files with 4 additions and 1 deletion.
    1 change: 0 additions & 1 deletion delete_all_awslogs.sh
    Original file line number Diff line number Diff line change
    @@ -1 +0,0 @@
    aws logs describe-log-groups --query 'logGroups[*].logGroupName' --output table | awk '{print $2}' | grep -v ^$ | while read x; do aws logs delete-log-group --log-group-name $x; done
    4 changes: 4 additions & 0 deletions delete_all_awslogs.sh.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    ```sh
    aws logs describe-log-groups --query 'logGroups[*].logGroupName' --output table | \
    awk '{print $2}' | grep -v ^$ | while read x; do aws logs delete-log-group --log-group-name $x; done
    ```
  4. @pahud pahud created this gist Apr 29, 2017.
    1 change: 1 addition & 0 deletions delete_all_awslogs.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    aws logs describe-log-groups --query 'logGroups[*].logGroupName' --output table | awk '{print $2}' | grep -v ^$ | while read x; do aws logs delete-log-group --log-group-name $x; done