Installing syslog for our NEtscreen firewall.
apt-get install sysklogd
configure sysklog.conf
##############################################
#Save boot messages also to boot.log
local7.* /logs/boot.log
### LOGS for NETSCREEN
local0.* /logs/netscreen.log
####################################################
Here is the final script : Netscreen.sh
############################################################
#! /bin/bash
mv /logs/netscreen.log /logs/`date --date="1 day ago" +%Y-%m-%d`.log
gzip /logs/`date --date="1 day ago" +%Y-%m-%d`.log
touch /logs/netscreen.log
/etc/init.d/sysklogd restart
############################################################
And here is the cronjob:
cronjob -e
run @ 12:01 midnight everyday
############################################################
# m h dom mon dow command
1 0 * * * /bin/bash /logs/netscreen.sh
############################################################
root@vm-ubuntu64srv:/logs# dpkg -s sysklogd |grep Version
Version: 1.5-1ubuntu1
Added the -r option to /etc/init.d/sysklogd (SYSLOGD="-r -u syslog"). This didn't work and I found out that there are another file (thanks to Jon for pointing that out!) /etc/default/syslogd that probably overrides the settings from the /etc/init.d/sysklogd. I don't know why, but it worked when I put the -r there as well.
Monday, June 1, 2009
Subscribe to:
Post Comments (Atom)
1 comment:
Correction crontab -e not cronjob -e
Post a Comment