Bug #143

Log files not rotating properly

Added by mihanson about 16 years ago. Updated about 16 years ago.

Status:Closed Start date:
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:- Spent time: -
Target version:-

Description

It seems that no old log files are being saved.

[root@mythbox-mbe ~]# ls -la /etc/logrotate.d/ total 28 drwxr-xr-x 2 root root 4096 2009-01-22 08:09 . drwxr-xr-x 49 root root 4096 2009-01-19 20:40 .. -rw-r--r-- 1 root root 65 2008-09-04 16:50 crond -rw-r--r-- 1 root root 145 2009-01-10 00:15 lighttpd -rw-r--r-- 1 root root 63 2009-01-07 00:27 lirc -rw-r--r-- 1 root root 991 2009-01-22 08:15 mythtv -rw-r--r-- 1 root root 354 2008-09-04 19:05 syslog-ng [root@mythbox-mbe ~]# cat /etc/logrotate.d/syslog-ng /var/log/messages.log /var/log/auth.log /var/log/mail.log /var/log/kernel.log /var/log/errors.log /var/log/daemon.log /var/log/user.log /var/log/iptables.log /var/log/everything.log /var/log/syslog.log /var/log/acpid.log { missingok sharedscripts postrotate /bin/kill -HUP `cat /var/run/syslog-ng.pid 2>/dev/null` 2> /dev/null || true endscript } [root@mythbox-mbe ~]# ls -la /var/log total 2048 drwxr-xr-x 6 root root 4096 2009-01-20 14:16 . drwxr-xr-x 14 root root 4096 2009-01-15 09:14 .. -rw-r--r-- 1 root root 42273 2009-01-20 14:16 Xorg.0.log -rw-r--r-- 1 root root 361 2009-01-19 12:48 Xorg.0.log.old -rw-r----- 1 root log 359847 2009-01-22 13:18 acpid.log -rw-r----- 1 root log 24998 2009-01-22 13:17 auth.log -rw------- 1 root root 0 2009-01-15 09:17 btmp -rw-r----- 1 root log 13733 2009-01-22 10:47 daemon.log -rw-r--r-- 1 root root 38518 2009-01-19 15:48 dmesg.log -rw-r----- 1 root log 12396 2009-01-19 15:48 errors.log -rw-r----- 1 root log 557446 2009-01-22 10:47 everything.log -rw------- 1 root root 24024 2009-01-20 14:15 faillog -rw-r----- 1 root log 340273 2009-01-20 14:20 kernel.log -rw-r--r-- 1 root root 292584 2009-01-22 13:17 lastlog drwxr-xr-x 2 http http 4096 2009-01-19 14:33 lighttpd -rw-r--r-- 1 root root 10157 2009-01-22 10:59 lircd -rw-r----- 1 root log 494284 2009-01-22 10:47 messages.log -rw-r--r-- 1 mysql root 0 2009-01-19 12:50 mysqld.log drwxrwxr-- 2 root mythtv 4096 2009-01-20 05:00 mythtv -rw-r--r-- 1 root root 37062 2009-01-19 12:48 mythvantage_install.log -rw-r--r-- 1 root root 235 2009-01-19 15:48 network.init -rw-r--r-- 1 root root 145 2009-01-19 15:48 network.init.error -rw-r--r-- 1 root root 833 2009-01-22 09:20 ntp.log drwxr-xr-x 2 root root 4096 2009-01-15 09:17 old -rw-r--r-- 1 root root 4437 2009-01-20 14:09 pacman.log -rw-r----- 1 root log 957 2009-01-19 15:48 syslog.log -rw-r----- 1 root log 88 2009-01-19 15:43 user.log -rw-r--r-- 1 root root 0 2009-01-15 09:17 utmp drwx------ 2 root bin 4096 2009-01-19 14:28 webmin -rw-r--r-- 1 root root 35328 2009-01-22 13:17 wtmp [root@mythbox-mbe ~]# cat /etc/logrotate.d/mythtv # Rotate the logs once a week, or more frequently if they # exceed 10Mb in size (size is checked daily). daily # 'copytruncate' is used for logs generated by # currently-running programs that should not be restarted # (and can't be signalled to start a new log) after the # rotation. It duplicates the existing log file and then # sets the length of the existing file to 0. The only time # this would break would be if the program writing the log # was using lseek. copytruncate # After rotating the files, leave the most recent rotated # copy alone but gzip everything else to save space. compress delaycompress # If a log isn't present then don't worry about it. missingok # Don't rotate an empty file. notifempty # end of the global options /var/log/mythtv/mythbackend.log /var/log/mythtv/mythfrontend.log /var/log/mythtv/rsync_myth.log { rotate 14 notifempty } # Different options for mythfilldatabase: /var/log/mythtv/mythfilldatabase.log { rotate 2 notifempty }

History

Updated by tjc about 16 years ago

Everything looks kosher, the cron job exists, and running the same command with -d (debug) shows sane results. On the other hand it's only set to rotate the logs once a week which might be fooling you. Try the following;

- As root run "/usr/sbin/logrotate -d /etc/logrotate.conf". You should see a lot of messages along the lines of "log does not need rotating".

- Then try adding the "-f" (force) option. This should show all the existing logs being renamed (doesn't really happen in debug BTW)

- Change the setting in /etc/logrotate.conf from "weekly" to "daily", restart the system, and report back in 24 hours.

Also available in: Atom PDF