Last active
March 27, 2017 15:39
-
-
Save manuelnaranjo/e21f187e5c71e530e450f626cfa8bfa0 to your computer and use it in GitHub Desktop.
Remove all cloudwatch streams
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
# this script will clear up and remove all registered cloudwatch log streams | |
# there's no filter so use it with caution | |
import boto3 | |
client = boto3.client('logs') | |
while True: | |
response = client.describe_log_groups() | |
if not response or 'logGroups' not in response: | |
break | |
logs = response['logGroups'] | |
if not logs or len(logs) == 0: | |
break | |
for logGroup in logs: | |
name = logGroup['logGroupName'] | |
print 'deleting', name | |
client.delete_log_group(logGroupName=name) | |
print 'done' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment