Skip to content

Instantly share code, notes, and snippets.

@sats17
Created November 8, 2022 06:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sats17/6150cfc17c3d4108b056e190aa6ff09c to your computer and use it in GitHub Desktop.
Save sats17/6150cfc17c3d4108b056e190aa6ff09c to your computer and use it in GitHub Desktop.
AWS Cloudwatch queries
1) Get lambda initialization time -
fields @timestamp, @message, @initDuration
| filter @initDuration > 5
| sort @timestamp desc
| limit 20
2) Search request by uuid(After searching by uuid, copy lambda requestId from one of logs and use same query with that id) -
filter @message like /a348b4c3-7915-4f5f-942b-b79f3589757f/
| fields @timestamp, @message
3) Get average response duration period(For duration add @duration) -
filter @type = "REPORT" and @logStream like '[5]'
| stats count(*) as count, avg(@initDuration)
 by bin(10m)
4) Get max min duration response of lambda session -
filter @type = "REPORT"
| stats avg(@duration), max(@duration), min(@duration) by bin(5m)
5) Get p90 performance results -
filter @type = "REPORT" and @logStream like '[4]'
| stats count(*) as count, avg(@duration), percentile(@duration, 90) as res_pct_90
 by bin(70m)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment