- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- collect log files based on date
Operating System - Linux
1753897
Members
7781
Online
108809
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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
тАО02-25-2010 10:39 PM
тАО02-25-2010 10:39 PM
Hi,
I want to collect the log files based on particular date. How can i collect them.
Can someone help me.
Thanks!
I want to collect the log files based on particular date. How can i collect them.
Can someone help me.
Thanks!
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-25-2010 11:30 PM
тАО02-25-2010 11:30 PM
Re: collect log files based on date
You can try this :
find /path_to_files -iname "*.file_extension" -mtime -period_of_time -print
where is :
iname , i means , not to pay attention on big/small letters in name
-period_of_time --period of time you are want to search
So if you want to look for txt files changed in last 15 days and in /home directory command would be
find /home -iname "*.txt" -mtime -15 -print
Hope this helps
find /path_to_files -iname "*.file_extension" -mtime -period_of_time -print
where is :
iname , i means , not to pay attention on big/small letters in name
-period_of_time --period of time you are want to search
So if you want to look for txt files changed in last 15 days and in /home directory command would be
find /home -iname "*.txt" -mtime -15 -print
Hope this helps
/home/BIH/Sarajevo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-26-2010 12:43 AM
тАО02-26-2010 12:43 AM
Re: collect log files based on date
Hi,
I want to do for the /var/log/messages. How can i collect log files for yesterday only.
Thanks!
I want to do for the /var/log/messages. How can i collect log files for yesterday only.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-26-2010 01:44 AM
тАО02-26-2010 01:44 AM
Solution
Usually, on Linux one has logrotate working.
If nothing else is defined in
/etc/logrotate.d/syslog
then the global rotation scheme as defined in
/etc/logrotate.conf holds which is "daily".
Then check your crontab when the daily jobs are executed.
# grep daily /etc/crontab
02 4 * * * root run-parts /etc/cron.daily
# ls -l /etc/cron.daily/logrotate
-rwxr-xr-x 1 root root 180 Jul 13 2005 /etc/cron.daily/logrotate
So, on my sample box rotation starts daily at 04:02
Now, depending how many rotation cycles or generations are defined in either
/etc/logrotate.d/syslog or
/etc/logrotate.conf
that many days back of syslog (messages) you will have before older rolled files will be overwritten with newer ones.
For older logs you would have to restore them from your backups.
If nothing else is defined in
/etc/logrotate.d/syslog
then the global rotation scheme as defined in
/etc/logrotate.conf holds which is "daily".
Then check your crontab when the daily jobs are executed.
# grep daily /etc/crontab
02 4 * * * root run-parts /etc/cron.daily
# ls -l /etc/cron.daily/logrotate
-rwxr-xr-x 1 root root 180 Jul 13 2005 /etc/cron.daily/logrotate
So, on my sample box rotation starts daily at 04:02
Now, depending how many rotation cycles or generations are defined in either
/etc/logrotate.d/syslog or
/etc/logrotate.conf
that many days back of syslog (messages) you will have before older rolled files will be overwritten with newer ones.
For older logs you would have to restore them from your backups.
Madness, thy name is system administration
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP