Generative AI for Technical Writer or Information Developers
HP-UX 11i Log File Management with Logrotate by Dusan Baljevic
1. Dusan Baljevic
dusan.baljevic@ieee.org
By default, HP-UX does not have any global tool to manage log file archiving and rotation. A
good, open-source option is to use logrotate.
a) Go to:
http://hpux.connect.org.uk/hppd/hpux/Sysadmin/logrotate-3.8.7/
Install it on HP-UX server (and all prerequisites).
b) Set up a cron job. For example:
# crontab -l
# Entry for monitoring status of the EMSHAProvider
5,20,35,50 * * * * /etc/opt/resmon/lbin/mon_EMSHAProvider_state.sh
5,20,35,50 * * * * /opt/sfm/bin/restart_sfm.sh
10,20,30,40,50 * * * * /usr/sbin/dmesg - >> /var/adm/messages # Entry for vacuuming the CERDB
5 1 * * * /opt/psb/vacuum
5,20,35,50 * * * * /opt/raidsaprovider/bin/restart_raidsaprovider.sh
5,20,35,50 * * * * /opt/sas/provider/bin/restart_sasprovider.sh
5,20,35,50 * * * * /opt/fcprovider/bin/restart_fcprovider.sh
5,20,35,50 * * * * /opt/dasprovider/bin/restart_dasprovider.sh
5,20,35,50 * * * * /opt/psb/bin/restart_logserv.sh
# logrotate
0 0 * * * /usr/local/sbin/logrotate /etc/logrotate.conf>/var/adm/syslog/logrotate.log 2>&1
c) Set up the /etc/logrotate.conf. For example:
# cat /etc/logrotate.conf
# sample logrotate configuration file
compress
/var/adm/syslog/syslog.log {
rotate 5
weekly
postrotate
/usr/bin/kill -HUP `cat /var/run/syslog.pid`
endscript
}
/var/adm/syslog/mail.log {
rotate 5
weekly
postrotate
/usr/bin/kill -HUP `cat /var/run/syslog.pid`
endscript
}