Operating System - HP-UX
1753468 Members
4458 Online
108794 Solutions
New Discussion

Re: How to rotate log every day and how to keep 9 increments of logs in hp-ux 11.31

 

How to rotate log every day and how to keep 9 increments of logs in hp-ux 11.31

Hi,

I want to know how to rotate logs everyday. Is this possible by editing /etc/rc.config.d/syslogd??? If then how i do that? And i have another query. How i will keep at least 9 increments of logs in my local system? It's very urgent. Please help me to solve above issues ASAP.

 

 

 

 

Regards,

Arafat

8 REPLIES 8
Hakki Aydin Ucar
Honored Contributor

Re: How to rotate log every day and how to keep 9 increments of logs in hp-ux 11.31

in normally , when system is rebooted, the startup sequence for syslog (/sbin/init.d/syslogd) will rename the oldsyslog.log file to OLDsyslog.log. if you want totake control of it you can use cron to automate and can use a script inside.

first copy the current syslog.log to syslog.log$$ then empty the log file;

 

# cp syslog.log syslog.log$$

# > syslog.log

Horia Chirculescu
Honored Contributor

Re: How to rotate log every day and how to keep 9 increments of logs in hp-ux 11.31

Hello,

 

You can use logrotate ported to HP-UX:

 

http://hpux.connect.org.uk/hppd/hpux/Sysadmin/logrotate-3.7.9/

 

 

Best regards from Romania,
Horia.

Re: How to rotate log every day and how to keep 9 increments of logs in hp-ux 11.31

hello hakki,
how i use this? plz give me a sample script. and what is the meaning of $$?
Dennis Handly
Acclaimed Contributor

Re: How to rotate log every day and how to keep 9 increments of logs in hp-ux 11.31

>what is the meaning of $$?

 

$$ is the shell variable for the current PID.  It is used as a fairly unique value before recycled.

Hakki Aydin Ucar
Honored Contributor

Re: How to rotate log every day and how to keep 9 increments of logs in hp-ux 11.31

simple script can be:

 

#!/usr/bin/sh
/usr/bin/cd /var/adm/syslog
/usr/bin/cp syslog.log syslog.log$$

#OR use dated version  : /usr/bin/cp syslog.log syslog.$(/usr/bin/date +%d%m%y)

#empty current log
> syslog.log

Re: How to rotate log every day and how to keep 9 increments of logs in hp-ux 11.31

thnx hakki for ur help........it is very much helpful for me.....but what about 9 increment of logs????? how i keep at least 9 increments of logs in local system???

Stephan_
Regular Advisor

Re: How to rotate log every day and how to keep 9 increments of logs in hp-ux 11.31

Hi,

you might want to try a script from Bill Hassel, you can find it here:

 

http://h30499.www3.hp.com/t5/System-Administration/Trim-Log-Files/m-p/3847979#M274410

 

hth

Stephan

How to assign points on this new forums --> Kudos - what, where, how, and why!
How to find the right forum --> New forum location by ITRC tree

"we wouldn't call it code, if we could read it ..."
Dennis Handly
Acclaimed Contributor

Re: How to rotate log every day and how to keep 9 increments of logs in hp-ux 11.31

>Is this possible by editing /etc/rc.config.d/syslogd?

 

No that would be too simple.  :-(

 

About the only option is: PREV_OLDSYSLOG_LINES

 

>How I will keep at least 9 increments of logs in my local system?

 

You'll need to do some scripting.  Look at the above suggestions, especially logrotate.