Created
February 24, 2020 14:07
-
-
Save jpetitcolas/2903277cb34c56175de1808095339baa to your computer and use it in GitHub Desktop.
Getting AWS CloudWatch Insight results from CLI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aws logs start-query \ | |
--profile [PROFILE] \ | |
--log-group-name [GROUP_NAME] \ | |
--start-time `date --date="-30 minutes" "+%s"` \ | |
--end-time `date "+%s"` \ | |
--query-string 'fields @message | limit 50' \ | |
| jq '.queryId' \ | |
| xargs -I{} aws --profile [PROFILE] logs get-query-results --query-id {} \ | |
| jq '.results | .[][0].value' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment