Show / Hide Table of Contents

Delete Orphaned Lambda and API Gateway CloudWatch Logs Command

The util delete-orphan-logs command is used to delete CloudWatch log groups that were created by Lambda functions and API Gateway instances which no longer exist. Note, LambdaSharp modules always clean up their Lambda and API Gateway logs. However, if you have been experimenting with Lambda or API Gateway in the past, you may have a lot of CloudWatch logs that are lingering for no reason. This command will take care of them.

Options

--dryrun

(optional) Show the result of the clean-up operation without deleting anything

--aws-profile|-P <NAME>

(optional) Use a specific AWS profile from the AWS credentials file

--aws-region <NAME>

(optional) Use a specific AWS region (default: read from AWS profile)

Examples

Delete all orphaned Lambda CloudWatch logs

Using PowerShell/Bash:

lash util delete-orphan-logs

Output:

LambdaSharp CLI (v0.6.0.1) - Delete orphaned Lambda CloudWatch logs

* deleted '/aws/lambda/test-20190304152100-analytics-43JSABQ42WAP'
* deleted 'API-Gateway-Execution-Logs_sdpwn23vx4/LATEST'
...
* deleted '/aws/apigateway/59jn68v9qc/LATEST'

Found 285 log groups. Active 112. Orphaned 172. Skipped 0.

Done (finished: 6/12/2019 5:30:21 AM; duration: 00:00:05.8609430)
In This Article
Back to top Generated by DocFX