- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Trim Log Files.
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
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
тАО08-22-2006 12:13 AM
тАО08-22-2006 12:13 AM
Can anyone please let me know how to trim the log files (like Cron, syslod etc.) when the process is active.
I had followed the following but it didnt append the files.
1. Stop(pause) the process usind #kill -STOP
2. Rename the file cron log file
#mv log log.old
3. Touched the new file with same file permissions.
#touch log
4. Continue the process #kill -CONT
after doing this the cron process didnt append the log file.
i had to manually restart the service then it started writing to log file.
I had this probelm always with few log files.. can anyone tell me the best way to do it.
Many thanks in advance !!
Regards
Govinda.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-22-2006 12:17 AM
тАО08-22-2006 12:17 AM
Re: Trim Log Files.
I am sure this thread will help you out,
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1033864
Regards,
Jaime.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-22-2006 12:21 AM
тАО08-22-2006 12:21 AM
Re: Trim Log Files.
If you want to empty the entire file, simply do, for example:
# cat /dev/null > /var/adm/syslog/syslog.log
If you want to preserve a copy of 'syslog' and open a new one, one simple way is to do:
# /sbin/init.d/syslogd stop
# /sbin/init.d/syslogd start
This action creates '/var/adm/syslog/OLDsyslog.log'.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-22-2006 12:23 AM
тАО08-22-2006 12:23 AM
Re: Trim Log Files.
Thanks for the reply, I had look at the thread but it talks about using SAM to trim the logs.
I need to know how we can handle the running process using command prompt while trimming the activity logs.
many Thanks!!
Govinda.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-22-2006 12:28 AM
тАО08-22-2006 12:28 AM
Re: Trim Log Files.
I dont want to stop the process. please let me know if this is possible without stop.
regards
govinda.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-22-2006 12:38 AM
тАО08-22-2006 12:38 AM
Re: Trim Log Files.
I do not know if Mattew will be able to see your other post on time, but in the mean time, take a look at this utility,
http://hpux.ee.ualberta.ca/hppd/hpux/Sysadmin/logrotate-2.5/
Very helpful, and it might be able to fit your needs,
Regards,
Jaime.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-22-2006 12:43 AM
тАО08-22-2006 12:43 AM
Re: Trim Log Files.
Rather than moving the original file, copy it with a -p
cp -p file.log filenew.log
thaen cat /dev/null to the original file
cat /dev/null > file.log
this zero out the file without affecting any prgram using it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-22-2006 12:44 AM
тАО08-22-2006 12:44 AM
Re: Trim Log Files.
The only way for not having to restart is, as James mentionned >...
moving the file doesnt work because it will follow the mv rather than writing in a new file...
So the only option is to copy the file AND
and zero the file following James syntax e.g:
# cat /dev/null > /var/adm/syslog/syslog.log
All the best
Victor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-22-2006 12:54 AM
тАО08-22-2006 12:54 AM
Re: Trim Log Files.
Typically, I copy them off to NFS central storage for possible audits and....
> logfile.name
In a cron script.
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
тАО08-22-2006 01:02 AM
тАО08-22-2006 01:02 AM
Solutioncp -p file_name new_file_name
cat /dev/null > file_name
The processes that are appending to the log file will continue to append to the file which happens to be zero length now. After you have zeroed the file, you may wish to move the copy or at least analyze the file for important data and then compress the file. A very typical method is to shift a series of files, perhaps the last 10 copies so you have a long history. The best technique is to trim logfiles based on size so only the fastest growing files will be regularly trimmed.
The attached script does exactly this function with parameters to control the number of copies and the size to start trimming. Run this script once to setup the copies and perform the first trim. Then add the script to cron to run once a day or once a week. The script does nothing if the files are too small for trimming.
Bill Hassell, sysadmin