Skip to content

Instantly share code, notes, and snippets.

@jayers99
Last active January 9, 2019 18:23
Show Gist options
  • Save jayers99/a196201ba2b38efded07ca464417c058 to your computer and use it in GitHub Desktop.
Save jayers99/a196201ba2b38efded07ca464417c058 to your computer and use it in GitHub Desktop.
AWS Flow Log Sample
# column names
# https://docs.aws.amazon.com/vpc/latest/userguide/flow-logs.html
logGroupName=
logStreamName=
aws logs filter-log-events --start-time `date -d 2018-9-28T18:00:00Z +%s`000 --log-group-name $logGroupName --log-stream-names $logStreamName --filter-pattern REJECT
aws logs filter-log-events --start-time `date -d 2018-9-28T18:00:00Z +%s`000 --log-group-name $logGroupName --log-stream-names $logStreamName --filter-pattern REJECT | jq -r '.events[] | "\(.timestamp) \(.message)"' | cut -d ' ' -f1,5,6,7,8,14 | awk '{print system("date -d @" substr($0,1,10)) substr($0,14)}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment