Operating System - HP-UX
1834164 Members
2449 Online
110064 Solutions
New Discussion

Trimming log files in SAM

 
Patrick_85
Occasional Contributor

Trimming log files in SAM

Hello,

Is there a way to automate the trimming of log files in SAM (or any other way)? When I look in SAM, I can set the recommended size, but not how to trim them once they get beyond the recommended size.

Thanks
4 REPLIES 4
Steven E. Protter
Exalted Contributor

Re: Trimming log files in SAM

You can use cron to trim the logs.

For the sake of simplicity, I have a script that does these things.

1) It creates a tar file with all the logs.

2) It zeros out the logs

> logfilename

I run it once a month via cron.

The list of files I deal with I got from sam's trim utility.

The only thing you need to decide is frequency, based on how fast /var fills up.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
malay boy
Trusted Contributor

Re: Trimming log files in SAM

Yap SEP is correct .You need to run a cron for this.
But in SAM routine task->System Log Files ,you also can trim the log file .Foe every system log files ,there are recommended size.So you can asked SAM to trim up to recomemded size.But still manually.

regards
mB
There are three person in my team-Me ,myself and I.
Michael Tully
Honored Contributor

Re: Trimming log files in SAM

Setting up the below script to run under 'cron' may assist you. you can customise it to your requirements.

http://www.introcomp.co.uk/examples/logrotate.html

regards
Michael
"When I have trouble spelling, it's called fat finger syndrome"
Anyone for a Mutiny ?
Yogeeraj_1
Honored Contributor

Re: Trimming log files in SAM

hi,

There is also a Log management tool for sysadmins for HP-UX - Logrotate. This 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.


You can download it from:
http://gatekeep.cs.utah.edu/hppd/hpux/Sysadmin/logrotate-2.5/

You can use this and with proper cronjobs implement what you desire...

hope this helps!

regards
Yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)