Last active
May 18, 2021 18:04
-
-
Save skyzyx/6c47ab78adcb4802a67a66c1a2c0f6a3 to your computer and use it in GitHub Desktop.
CloudWatch Insights snippets
This file contains 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
# WHERE logs are json AND fields are boolean... | |
# BOOL fields are converted to 1 for true, and 0 for false. | |
# So let's count them. | |
fields `httpVersions.HTTP/1.1`, `httpVersions.HTTP/2`, `httpVersions.HTTP/3` | |
| stats sum(`httpVersions.HTTP/1.1`) as http1, sum(`httpVersions.HTTP/2`) as http2, sum(`httpVersions.HTTP/3`) as http3 | |
# OR parse the JSON as plain text. | |
parse '"HTTP/1.1":true' as @h1 | |
| parse '"HTTP/2":true' as @h2 | |
| parse '"HTTP/3":true' as @h3 | |
| filter ispresent(@h1) or ispresent(@h2) or ispresent(@h3) | |
| stats count(@h1) as http1, count(@h2) as http2, count(@h3) as http3 by bin(6h) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment