Skip to content

Instantly share code, notes, and snippets.

@sasasin
Created August 8, 2023 04:08
Show Gist options
  • Save sasasin/f56cb6ea7f95a84aa518a77383f785ea to your computer and use it in GitHub Desktop.
Save sasasin/f56cb6ea7f95a84aa518a77383f785ea to your computer and use it in GitHub Desktop.
AWS Lambda Fn のメモリ使用量を CloudWatch Logs Insight で調べるやつ
# CloudWatch Logs Insights で調べたいロググループと時間範囲を選んで、以下クエリを実行する。
# bin(24h) は 24h 単位に集約して集計しろという指定。調べたい期間に書き換えて実行する。5m とか 8h とか 2d とか
# https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax-Stats.html
fields @timestamp, @message, @logStream, @log
| filter @type = "REPORT"
| stats min(@maxMemoryUsed), avg(@maxMemoryUsed), max(@maxMemoryUsed) by bin(24h)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment