For years, I used to run a logrotate script which I think Gerard posted at some point. Seemed to work adequately, although it probably did not do anything for things I'd added over the years which logged separately (on my server, postgresql and apache, on desktops cups and pm-utils) - and it sometimes took a very long while before the logs on a desktop got rotated.
But, when it ran (weekly on my server, irregularly on the desktop systems) it mailed me to tell me it had run. I'm simple, I like that sort of information ;) When logrotate went into BLFS, it looked worth trying. I asked on -dev before I had built it, and got some advice, and then intermittently looked to see if it had done anything. My impression is that the basic instructions in BLFS _only_ rotate wtmp and lastlog, although they purport to handle all regular logs [ specifically, it ran and gzipped both of those, but did not touch sys.log kern.log etc ]. As I said, my logs now appear to be rotating from time to time (this is a desktop, the time when they rotate does not matter). But I'm not getting any messages to say that they rotated. In root's fcrontab I have the following - other tasks with a similar mailto setting do send me mail - and this runs daily if hte box is up, so that logrotate can check if there is anything to do. # every day, check if logs are ready to rotate. @reset,mailto([email protected]) 1d /usr/sbin/logrotate /etc/logrotate.conf Clearly, any mail only comes from what is in /etc/logrotate.conf. There, I have the following which appear to work, except that I do not get any mail messages (the nomail comment predates what is now in the book - it's only a comment ;-) : # Begin of /etc/logrotate.conf # Rotate log files weekly weekly # Don't send mail to anybody # actually, this appears to be to mail the OLD log files nomail # If the log file is empty, it will not be rotated notifempty # Number of backups that will be kept # This will keep the 4 newest backups only # NB - the BLFS BOOK uses 2 rotate 4 # Create new empty files after rotating old ones # This will create empty log files, with owner # set to root, group set to sys, and permissions 644 create 0664 root sys # Compress the backups with gzip compress # these parts based on man 1 logrotate: /var/log/sys.log { compress rotate 4 weekly postrotate echo "rotating syslog" /bin/killall -HUP syslogd endscript } # this seems to accept wildcards, but not bash's /var/log/{auth,boot}.log /var/log/auth.log /var/log/boot.log /var/log/kern.log /var/log/mail.log /var/log/user.log { compress sharedscripts rotate 4 weekly copytruncate postrotate echo "rotating minor log(s)" endscript } # No packages own lastlog or wtmp -- rotate them here /var/log/wtmp { monthly create 0664 root utmp rotate 1 } /var/log/lastlog { monthly rotate 1 } # Some packages drop log rotation info in this directory # so we include any file in it. include /etc/logrotate.d # End of /etc/logrotate.conf - from that I was expecting to get the echo'd "rotating" messages in my mail, but that part does not work. Similarly, I have files in /etc/logrotate.d/ for cups and pm (i.e. suspend) - dunno if the cups part works, I only printed a page on the 12th, but the pm logs rotated and again I got no message. For these I have: #cat /etc/logrotate.d/pm.conf /var/log/pm* { compress sharedscripts rotate 4 weekly copytruncate postrotate echo "rotating power management logs" endscript } #cat /etc/logrotate.d/cups.conf /var/log/cups/* { compress sharedscripts rotate 4 weekly copytruncate postrotate echo "rotating cups logs" endscript } and again I do not get a message when it runs. Is there an easy way for me to alter these files, or the fcrontab invocation of logrotate, so that I get a report when it has done something ? For my server, I _really_ want to get messages that logs have rotated. Also, does anybody find that the version of /etc/logrotate.conf in the book DOES rotate their logs ? ĸen -- Nanny Ogg usually went to bed early. After all, she was an old lady. Sometimes she went to bed as early as 6 a.m. -- http://lists.linuxfromscratch.org/listinfo/blfs-support FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page
