Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaihendry/21597f3c0f86df6636945e0e71f73e6c to your computer and use it in GitHub Desktop.
Save kaihendry/21597f3c0f86df6636945e0e71f73e6c to your computer and use it in GitHub Desktop.
CloudWatch examples
# Full text search
[hendry@t480s 5xx]$ cat bugzilla.sh
aws --profile uneet-dev logs filter-log-events --log-group-name bugzilla --start-time $(date -d "-1 hour" +%s000) \
--filter-pattern '"apex/ping/v1.0"'
# (faster) Query on a JSON structured log
[hendry@t480s 5xx]$ cat alambda.sh
aws --profile uneet-demo logs filter-log-events --log-group-name "/aws/lambda/alambda_simple" --start-time $(date -d "-8
hours" +%s000) \
--filter-pattern '{ $.level = "error" }' |
jq '.events[].message|fromjson'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment