- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Triming of logfiles 3 months old entries
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
Forums
Discussions
Discussions
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
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-21-2005 11:58 AM
03-21-2005 11:58 AM
Triming of logfiles 3 months old entries
I want to remove 3months old entries in a logfile how should I go about doing it?
Thanks!
Henry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2005 01:09 PM
03-21-2005 01:09 PM
Re: Triming of logfiles 3 months old entries
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2005 02:30 PM
03-21-2005 02:30 PM
Re: Triming of logfiles 3 months old entries
Your log file entries must be having some kind of date specification.
For example
An oracle alert log entries with date specification as Tue Mar 1 17:58:49 2005
A syslog will have entries with date specification as Feb 9 16:15:00
As Clay mentioned, you will have to read the entire file compare each line with the date format and decide if the entry needs to be deleted ot remains in the file.
You can use the date command formats to compare the date specification in your log file.
For eg:- `date +"%a %b %e %E"` will return Tue Mar 22 2005. So dependig on the date specification use the paramters and cat the log file from beginning to end in a look read each LINE and compare the date.
Indira A
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2005 02:19 AM
03-23-2005 02:19 AM
Re: Triming of logfiles 3 months old entries
As they are copied they have the date appended to the name, such as:
/arch/logs/syslog.2005-02-01
/arch/logs/mail.2005-02-01
After the files are copied to the arch directory, the oldest of each are removed by the script. I keep six months worth in there.
Then the script zero's out each log file, using:
/usr/bin/cat /dev/null > $logfile
That's how I handle mine. I don't do wtmp and btmp in this manner but I'm considering it. Any comments from readers on that? Can I use the same menthod as I do for the others?
Otherwise Henry, I hope this helps.
Fred
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2005 07:33 AM
03-28-2005 07:33 AM
Re: Triming of logfiles 3 months old entries
Scott Lindstrom
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2005 07:35 AM
03-28-2005 07:35 AM
Re: Triming of logfiles 3 months old entries
Scott
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2005 07:38 AM
03-28-2005 07:38 AM
Re: Triming of logfiles 3 months old entries
http://hpux.ee.ualberta.ca/hppd/hpux/Sysadmin/logrotate-2.5/
Logrotate is designed to ease administration of systems that generate large numbers of log files. It allows automatic rotation, compression, removal, and mailing of log files. Each log file may be handled daily, weekly, monthly, or when it grows too large.
Rgds...Geoff