Skip to content

Instantly share code, notes, and snippets.

@kvz
Created January 9, 2012 14:58
Show Gist options
  • Save kvz/1583283 to your computer and use it in GitHub Desktop.
Save kvz/1583283 to your computer and use it in GitHub Desktop.
Return serverlogs of a specific timeframe (between a few minutes)
DAY="2012-01-09"
HOUR="05"
MINUTE_FROM="48"
MINUTE_TO="53"
MATCH_TIME="${HOUR}:($(seq -f '%02g' -s '|' ${MINUTE_FROM} ${MINUTE_TO})):"
egrep -Ir "$(date --date="${DAY}" '+(%b %e|%d %b|%d/%b/%Y|%Y.%m.%d|%Y/%m/%d|%Y-%m-%d)[\ \-\.]')${MATCH_TIME}" /var/log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment