Last active
April 26, 2018 18:23
-
-
Save jincod/e9f8eef89a5332017edc9492493dbbf3 to your computer and use it in GitHub Desktop.
Powershell script: Delete all log groups from AWS CloudWatch
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
aws logs describe-log-groups --query logGroups --output json | ConvertFrom-Json | | |
ForEach-Object {$_.logGroupName} | ForEach-Object { aws logs delete-log-group --log-group-name $_ } |
Hi @RobertboothVentech
Sorry for the late answer. I didn't get any notifications.
I missed --output json
options for all aws cli calls.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I love the short scripts and have been trying to get the "default.ps1" Delete all AWS log groups to work; however, I get an error "ConvertFrom-Json : Invalid JSON primitive:" and not sure what is causing it. The command works in the sense that I can pull the logs groups using the "aws logs describe-log-groups --query logGroups" if I pull the ConvertFrom-Json off. Any ideas?