Skip to content

Instantly share code, notes, and snippets.

@ChrisSwanson
Created April 28, 2021 19:24
Show Gist options
  • Save ChrisSwanson/f7e1eb6bc04e55b137615ed695ecbdc7 to your computer and use it in GitHub Desktop.
Save ChrisSwanson/f7e1eb6bc04e55b137615ed695ecbdc7 to your computer and use it in GitHub Desktop.
Cloudtrail search to JSON
#!/usr/bin/bash
# this one liner searches for a value recursively in cloudtrail logs, to output
# a json structure that can be parsed back through jq later for further slicing
# and dicing of the data.
zgrep -Rhi "$VALUE" . | jq -c '.[]' | awk '{ print $0, "\n" }' > results.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment