- Community Home
- >
- Servers and Operating Systems
- >
- Operating System - Linux
- >
- General
- >
- how can I check the logs of previous 10 days ?
-
-
Categories
- Topics
- Hybrid IT with Cloud
- Mobile & IoT
- IT for Data & Analytics
- Transformation
- Strategy and Technology
- Products
- Cloud
- Integrated Systems
- Networking
- Servers and Operating Systems
- Services
- Storage
- Company
- Events
- Partner Solutions and Certifications
- Welcome
- Welcome
- Announcements
- Tips and Tricks
- Feedback
-
Blogs
- Alliances
- Around the Storage Block
- Behind the scenes @ Labs
- Converged Data Center Infrastructure
- Digital Transformation
- Grounded in the Cloud
- HPE Careers
- HPE Storage Tech Insiders
- Infrastructure Insights
- Inspiring Progress
- Internet of Things (IoT)
- My Learning Certification
- Networking
- OEM Solutions
- Servers: The Right Compute
- Telecom IQ
- Transforming IT
-
Quick Links
- Community
- Getting Started
- FAQ
- Ranking Overview
- Rules of Participation
- Contact
- Email us
- Tell us what you think
- Information Libraries
- Integrated Systems
- Networking
- Servers
- Storage
- Other HPE Sites
- Support Center
- Enterprise.nxt
- Marketplace
- Aruba Airheads Community
-
Categories
-
Forums
-
Blogs
-
InformationEnglish
how can I check the logs of previous 10 days ?
SOLVED- 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
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- 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
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- 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 ?
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
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- 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 ?
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
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- 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 ?
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
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- 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 ?
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
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- 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 ?
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
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- 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
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- 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 ?
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
Hewlett Packard Enterprise International
- Communities
- HPE Blogs and Forum
© Copyright 2018 Hewlett Packard Enterprise Development LP