Skip to content

Instantly share code, notes, and snippets.

@nguyentienlong
Created October 19, 2017 14:26
Show Gist options
  • Save nguyentienlong/b6ab9475ba6d7d26fdbfdecf95541de1 to your computer and use it in GitHub Desktop.
Save nguyentienlong/b6ab9475ba6d7d26fdbfdecf95541de1 to your computer and use it in GitHub Desktop.
Filter aws log events within period of time
#!/usr/bin/env bash
usage () {
echo "i4b-request-count.sh"
echo "---- Usage:"
echo "---- i4b-request-count [start-date-time] [end-date-time]"
echo "---- eg: ./i4b-request-count.sh '2017-09-15 00:00:00' '2017-10-15 23:59:59'"
}
E_NO_ARGS=65
if [ -z "$1" ] || [ -z "$2" ]; then
usage
exit $E_NO_ARGS
fi
# time in miliseconds
START_DATE_TIME=$(date --date="$1" +%s000)
END_DATE_TIME=$(date --date="$2" +%s000)
# API-Gateway-Execution-xxx/production should not be hard code
aws logs filter-log-events --log-group-name API-Gateway-Execution-xxx/production --start-time $START_DATE_TIME --end-time $END_DATE_TIME --output text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment