- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- how can I check the logs of previous 10 days ?
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-19-2009 09:03 PM
тАО03-19-2009 09:03 PM
Regards
Maaz
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-19-2009 10:27 PM
тАО03-19-2009 10:27 PM
Re: how can I check the logs of previous 10 days ?
cd /var/log
ls -lrt
That will reverse order display by date so you know what has been updated recently.
/var/log/messages is in order and I would suggest using the tail command.
I personally would just use vi and ctrl-g to get to the bottom of the file.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-19-2009 11:10 PM
тАО03-19-2009 11:10 PM
Re: how can I check the logs of previous 10 days ?
>cd /var/log
>ls -lrt
>That will reverse order display by date so you know what has been updated
>recently.
I dont need the above solution
>/var/log/messages is in order and I would suggest using the tail command.
I just want to check the last 10 days messages from /var/log/messages, for a specific daemon e.g 'cron'
yes, tail could be the an option, but help me
how can I use tail to check the logs of last 10 days
Regards
Maaz
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-20-2009 05:05 AM
тАО03-20-2009 05:05 AM
Re: how can I check the logs of previous 10 days ?
I just want to check the last 10 days messages from /var/log/messages, for a specific daemon e.g 'cron'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-20-2009 05:53 AM
тАО03-20-2009 05:53 AM
Re: how can I check the logs of previous 10 days ?
# find /var/log/ -name "messag*" -exec grep -B3 -A3 -i "cron" {} \;
Enjoy life.
Jean-Pierre Huc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-20-2009 05:54 AM
тАО03-20-2009 05:54 AM
Re: how can I check the logs of previous 10 days ?
For example:
grep Mar messages | grep
But, remember that cron handles it's specific log file /var/log/cron.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-20-2009 08:28 PM
тАО03-20-2009 08:28 PM
Solutionfor ((i=0;i<11;i++)); do grep "$(date --date="$i days ago" +%b' '%d)" /var/log/syslog; done
take care, if the date is below 10 maybe there's a space missing in the grep. Try around a bit, that example should be a nice base for improvements :)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-26-2009 02:42 AM
тАО03-26-2009 02:42 AM
Re: how can I check the logs of previous 10 days ?
Roman Schmidt thanks for excellent help
>take care, if the date is below 10 maybe
>there's a space missing in the grep. Try
>around a bit
yes you are right, I just did a small change and now its working even when the date is below 10
for ((i=0;i<11;i++)); do grep "$(date --date="$i days ago" +%b' '%e)" /var/log/messages |grep "cron"; done
i.e instead of '%d' I use '%e' with 'date', and its working with the date below 10. ;)
Thanks
Regards
Maaz