3
Dusan Baljevic [email protected] 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 CER DB 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

HP-UX 11i Log File Management with Logrotate by Dusan Baljevic

Embed Size (px)

DESCRIPTION

HP-UX 11i Log File Management with Logrotate

Citation preview

Page 1: HP-UX 11i Log File Management with Logrotate by Dusan Baljevic

Dusan Baljevic [email protected]

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.sh10,20,30,40,50 * * * * /usr/sbin/dmesg - >> /var/adm/messages # Entry for vacuuming the CER DB5 1 * * * /opt/psb/vacuum5,20,35,50 * * * * /opt/raidsaprovider/bin/restart_raidsaprovider.sh5,20,35,50 * * * * /opt/sas/provider/bin/restart_sasprovider.sh5,20,35,50 * * * * /opt/fcprovider/bin/restart_fcprovider.sh5,20,35,50 * * * * /opt/dasprovider/bin/restart_dasprovider.sh5,20,35,50 * * * * /opt/psb/bin/restart_logserv.sh# logrotate0 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 filecompress

/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}

Page 2: HP-UX 11i Log File Management with Logrotate by Dusan Baljevic

/var/adm/syslog/vseassist.log { rotate 12 monthly missingok}

/var/adm/sw/swverify.log { rotate 5 weekly postrotate /sbin/init.d/swagentd stop /sbin/init.d/swagentd start endscript}

#/var/log/httpd/access.log {# rotate 5# mail root# size 100k# sharedscripts# postrotate# /usr/bin/killall -HUP httpd# endscript#}

# no packages own wtmp -- we'll rotate them here /var/adm/wtmp { monthly create 0664 adm adm rotate 12}

/var/adm/wtmps { monthly create 0664 adm adm rotate 12}

/var/opt/wbem/*.log { monthly rotate 2 olddir /var/opt/wbem/prevmonth missingok postrotate /sbin/init.d/cim_server stop /sbin/init.d/cim_server start endscript nocompress}

Page 3: HP-UX 11i Log File Management with Logrotate by Dusan Baljevic

d) Check how it works:

# cat /var/run/logrotate.statuslogrotate state -- version 2"/var/adm/wtmp" 2013-3-16"/var/adm/sw/swverify.log" 2013-3-16"/var/adm/syslog/vseassist.log" 2011-3-16 "/var/opt/wbem/wbemassist.log" 2013-3-16 "/var/opt/wbem/install.log" 2011-3-16 "/var/adm/syslog/syslog.log" 2013-3-16 "/var/adm/wtmps" 2013-3-16 "/var/adm/syslog/mail.log" 2013-3-16