LinHES Forums
http://forums.linhes.org/

Logrotate issue with R6
http://forums.linhes.org/viewtopic.php?f=5&t=20203
Page 1 of 1

Author:  azrambler [ Tue Aug 04, 2009 12:54 am ]
Post subject:  Logrotate issue with R6

I have noticed in R6 my log files are not rotating properly. When the logs rotate, the logs continue to go into the new back version "logfile.log.1" and the current log file does not update. I noticed this after a ls -lrt of the /var/log area. All the current logfiles were zero in size. I then did a tail -f of everything.log and nothing was updating. A tail -f of everything.log.1 showed that this file was being written to.

Code:
ls -lrt /var/log
-rw-r----- 1 root   log          0 2009-08-02 00:02 user.log
-rw-r----- 1 root   log          0 2009-08-02 00:02 syslog.log
-rw-r----- 1 root   log          0 2009-08-02 00:02 messages.log
-rw-r--r-- 1 root   root         0 2009-08-02 00:02 lircd
drwxr-xr-x 2 http   http      4096 2009-08-02 00:02 lighttpd
-rw-r----- 1 root   log          0 2009-08-02 00:02 kernel.log
-rw-r----- 1 root   log          0 2009-08-02 00:02 everything.log
-rw-r----- 1 root   log          0 2009-08-02 00:02 errors.log
-rw-r----- 1 root   log          0 2009-08-02 00:02 daemon.log
-rw-r----- 1 root   log          0 2009-08-02 00:02 auth.log
-rw-r----- 1 root   log          0 2009-08-02 00:02 acpid.log
-rw-r----- 1 root   log     281295 2009-08-02 22:09 kernel.log.1
drwxr-xr-x 2 mythtv root      4096 2009-08-03 00:02 mythtv
-rw-r----- 1 root   log       5057 2009-08-03 00:02 user.log.1
-rw-r--r-- 1 root   root     46898 2009-08-03 20:51 Xorg.0.log
-rw------- 1 root   root     16512 2009-08-03 21:35 btmp
-rw-r--r-- 1 root   root    293168 2009-08-03 21:35 lastlog
-rw-rw-r-- 1 root   root      3072 2009-08-03 21:47 wtmp
-rw-r----- 1 root   log      18038 2009-08-03 22:38 daemon.log.1
-rw-r--r-- 1 root   root      1715 2009-08-03 22:41 lircd.1
-rw-r----- 1 root   log       8656 2009-08-03 22:41 auth.log.1
-rw-r----- 1 root   log     714461 2009-08-03 22:41 acpid.log.1
-rw-r----- 1 root   log     205741 2009-08-03 22:45 errors.log.1
-rw-r----- 1 root   log    1209431 2009-08-03 22:47 messages.log.1
-rw-r----- 1 root   log    1442247 2009-08-03 22:47 everything.log.1


I have changed nothing with the logrotate.conf file. It is from the R6 iso install. This is what is in the file:
Code:
[root@mythtv ~]# cat /etc/logrotate.conf
# see "man logrotate" for details
# rotate log files weekly
weekly

# keep 4 weeks worth of backlogs
rotate 4

# create new (empty) log files after rotating old ones
create

# uncomment this if you want your log files compressed
#compress

# Logs are moved into directory for rotation
# olddir /var/log/archive

# Ignore pacman saved files
tabooext + .pacorig .pacnew .pacsave

# Arch packages drop log rotation information into this directory
include /etc/logrotate.d

/var/log/wtmp {
    monthly
    create 0664 root root
    rotate 1
}


If I reboot the system, it starts logging to the correct log files.
I wanted to know if anyone else has seen this and any solutions for a fix.

Author:  bobmyth [ Tue Sep 01, 2009 9:26 pm ]
Post subject: 

The problem appears to be in /etc/logrotate.d/syslog-ng. The script assumes the program is running as a standard daemon, but it's not. Change this line:
Code:
/bin/kill -HUP `cat /var/run/syslog-ng.pid 2>/dev/null`  2> /dev/null || true

to
Code:
/usr/bin/killall -HUP -q syslog-ng


Next is probably the backend. Add:
Code:
   postrotate
       /usr/bin/killall -HUP -q mythbackend
   endscript

to /etc/logrotate.d/mythbackend.lr

I believe this leaves lirc and the same trick appears to work. My lirc appears to have no rotation set-up, so add this to /etc/logrotate.d/lirc
Code:
   postrotate
       /usr/bin/killall -HUP -q lircd
   endscript


You can run logrotate -d /etc/logrotate.conf to make sure you didn't badly damage logrotate.

Author:  nmcaullay [ Sun Nov 07, 2010 1:05 am ]
Post subject: 

on an unrelated note, this post saved my day... I had a dodgy DVBt card fill up my root partition, and cause my Linhes to barf. Without thinking, I cleared the /var/log directory, and rebooted, all back to normal...

Problem is that webmin, mythweb and monitorix all didnt work...

Turns out that for webmin and lighttp, they need the correct /var/log folders, with the correct ownership. Otherwise they barf.

The first post in this gave me the http/http owner/group information i needed!

Thanks

NAthan

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/