Skip to content

Instantly share code, notes, and snippets.

@manuelnaranjo
Last active March 27, 2017 15:39
Show Gist options
  • Save manuelnaranjo/e21f187e5c71e530e450f626cfa8bfa0 to your computer and use it in GitHub Desktop.
Save manuelnaranjo/e21f187e5c71e530e450f626cfa8bfa0 to your computer and use it in GitHub Desktop.
Remove all cloudwatch streams
# 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