Hi LinuxTracker,
I have followed up your steps to configure the logrotate for PF. I'd like to show you in deatails as below. Pls help to re-check and confirm if it is correct.
Step1: run command to install the logrotate
pkg_add -r http://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-8.2-release/sysutils/logrotate-3.7.9.tbz ( I'm using 2.0.1 RELEASE (amd64) built on Mon Dec 12 18:16:13 EST 2011 FreeBSD 8.1-RELEASE-p6)
Setp2: Create Archives folder at /archives to store the archiving log. I have also created folder logrotate.d at /usr/local/etc/logrotate.d ( I don't know its function. Could you explain?)
Step3: Create file /etc/logrotate.conf with content below:
location of archived log files
olddir /archives
/var/log/maillog {
# rotate logs daily (at midnight via cron)
daily
# don't complain if log is missing
missingok
# keep a month's worth of logfiles
rotate 30
# compress all but yesterday's logs with gzip
compress
delaycompress
# in case log file in use by process, truncates log file then copies it
copytruncate
# create new empty log file w/ same permissions as old log file (unsure if needed)
create 644 root wheel
# date appended onto archived log names
dateext
# beats me - this was already here
sharedscripts
# restart postifx
postrotate
/etc/init.d/postfix reload > /dev/null 2>&1 || true
endscript
}
system-specific logs may be configured here
Step4: I have tried to run the command /usr/local/sbin/logrotate -f -s /archives/logrotate.status /etc/logrotate.conf on shell console and it seems to work well.
I have also installed Cron package and created a cron job. I want this job will run at 12:00 AM daily. But I still didn't clear the time (minute, hour, mday, …) of cron job. Below is my cron job configuration:
minute: 0
hour: 24
mday: *
month: *
wday: *
who: root
command: /usr/local/sbin/logrotate -f -s /archives/logrotate.status /etc/logrotate.conf
Is it correct? (daily run at midnight)
P/S: I'm not a linux/*nix professional >:(
Thank you,
DQM