[CentOS] how to get data from syslog for a specific date range?

m.roth at 5-cent.us m.roth at 5-cent.us
Thu Jul 7 13:44:45 UTC 2011


Rudi Ahlers wrote:
> Hi all,
>
> Can someone please tell me, or point me in the right direction ( I
> have googled, with little luck) on how to get data from
> /var/logs/messages (and other log files) for a specified fe days (i.e
> 19 - 30 June 2011) ?
>
grep "Jul  5" /var/log/messages > 20110705.log

or
awk '$0 ~ /^Jul  [345]/' /var/log/messages > 201107_3-5.log

        mark




More information about the CentOS mailing list