-
Notifications
You must be signed in to change notification settings - Fork 7
Home
linux-wizard edited this page Mar 2, 2012
·
1 revision
Timegrep allows to perform a binary search through a log file to find a range of times and print the corresponding lines. Supported Log Formats:
- W3C Extended: %Y-%m-%d %H:%M:%S
- Syslog: %b %d %H:%M:%S
- NSCA Common/Apache: host rfc931 username [%d/%b/%Y:%H:%M:%S]
- Bind8: %d-%b-%Y %H:%M:%S.
/usr/bin/timegrep [--help] [--date "AAAA-MM-JJ"] [--start-time "HH:MM[:SS]"] [--end-time "HH:MM[:SS]"] <filename>**
--help: Display help
--date "YYYY-MM-DD" : Specify search date in log file. BY default use current date.
--start-time "HH:MM[:SS]" : Start of the searched time range ( default = 00:00:00 )
--end-time "HH:MM[:SS]": End of the searched time range ( default = 23:59:59 )
Extract /var/log/dpkg log entries from 15:30 to 15:45 for today:
/usr/bin/timegrep --start-time 15:30 --end-time 15h45 /var/log/dpkg
Extract list of installed packages between 15:30 and 15:45 for 2011 September 07th:
/usr/bin/timegrep --date 2011-09-07 --start-time 15:30 --end-time 15h45 /var/log/dpkg | grep installed