-
-
Save hmit208/c09365ea2758d044ec81f598c291d6b9 to your computer and use it in GitHub Desktop.
Revisions
-
jsyi revised this gist
Dec 5, 2017 . 1 changed file with 10 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -12,4 +12,13 @@ aws logs describe-log-groups | jq ".logGroups[].logGroupName" | grep -E "homeplu # xargs -t -n 1 date -r # (MacOS X) Format seconds timestamp into human-readable format. # (Other) Change `date -r` to `date -d` or other option appropriate to the installation of `date` included with your OS # BONUS: After verifying LogGroups as old/unused delete them # aws logs describe-log-groups | jq ".logGroups[].logGroupName" | grep -E "homeplus|mcdonalds" | grep -v "mcdonalds-v1-production" | xargs -n 1 -p aws logs delete-log-group --log-group-name # grep -v "mcdonalds-v1-production" # (Optional) Filter rule to excluded any LogGroups that should be kept. # xargs -n 1 -p aws logs delete-log-group --log-group-name # The -p option specifies that xargs should prompt for user confirmation before each command execution. -
jsyi created this gist
Dec 5, 2017 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ aws logs describe-log-groups | jq ".logGroups[].logGroupName" | grep -E "homeplus|mcdonalds" | xargs -n 1 -t aws logs describe-log-streams --query "logStreams[*].lastEventTimestamp" --log-group | jq "max/1000|floor" | xargs -t -n 1 date -r # aws logs describe-log-groups | jq ".logGroups[].logGroupName" # Get LogGroup names # grep -E "homeplus|mcdonalds" # (Optional) Filter LogGroup names # xargs -n 1 -t aws logs describe-log-streams --query "logStreams[*].lastEventTimestamp" --log-group | jq "max/1000|floor" # Get last event timestamp for each LogGroup. # (Optional) Convert milliseconds timestamp to seconds timestamp. # xargs -t -n 1 date -r # (MacOS X) Format seconds timestamp into human-readable format. # (Other) Change `date -r` to `date -d` or other option appropriate to the installation of `date` included with your OS