- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: delete record
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
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
10-12-2008 09:43 PM
10-12-2008 09:43 PM
delete record
"
05/01/08 Normal userA
05/01/08 Normal userB
05/02/08 Alnormal userC
"
"
10/01/08 Normal userA
10/02/08 Normal userA
"
Now I would like to keep the log current , so if the date is over 60 days , then remove this row , like above , the first three row should be removed as 05/01/08 and 05/02/08 is over 60 days ( today is 10/08/08 ) , can advise how to do it ? thx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2008 10:05 PM
10-12-2008 10:05 PM
Re: delete record
did you look into LOGROTATE?
Quote from Man logrotate:
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.
if your requirements are not that strict, you may wish to implement this.
hope this helps!
kind regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2008 10:09 PM
10-12-2008 10:09 PM
Re: delete record
See caljd script in:
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1173649
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=213185
After you get the date for 2 months ago, you could use sed to remove up to that date:
sed "1,\\:$OLD_DATE: d" log
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2008 10:31 PM
10-12-2008 10:31 PM
Re: delete record
LOGROTATE could do the requirement , it could check the date ( eg. 05/02/08 ) in the log ? thx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2008 10:43 PM
10-12-2008 10:43 PM
Re: delete record
Please read the docs.
e.g.
Please see:
http://www.debian-administration.org/articles/117
With logrotate, you will have to define the rules as per the specifications. I think it is better to implement something more generic.
otherwise you can implement the solution provided by Dennis above.
kind regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2008 01:42 AM
10-14-2008 01:42 AM
Re: delete record
I tried the script in the link
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=213185
but I have some problem when run it in my distro .
I have read the man page of logrotate , I think the below part is function works for my case , but I am not too understand how it fit to my requirement , could advise do I need to write the script to make it ? thx
/var/log/news/news.crit {
monthly
rotate 2
olddir /var/log/news/old
missingok
postrotate
kill -HUP ?ç at /var/run/inn.pid??
endscript
nocompress
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2008 04:38 PM
10-15-2008 04:38 PM
Re: delete record
can advise what can i do ?