On Fri, Mar 25, 2005 at 05:55:02PM -0500, Branden Robinson wrote:
> On Thu, Dec 16, 2004 at 02:40:00AM +0000, Andrew Suffield wrote:
> > Package: xdm
> > Severity: important
> > 
> > /etc/logrotate.d/xdm manages to delete the /var/log/xdm.log currently
> > in use, and never signals xdm to reopen its log file. Since xdm
> > usually stays running for weeks at a time, and the log is 'rotated'
> > daily, this means that most of the time xdm is writing to a deleted
> > file. Which is less than helpful.
> 
> I've never seen this behavior.

While xdm is running, edit /var/lib/logrotate/status and set the date
on /var/log/xdm.log to a couple of days ago, then run:

logrotate /etc/logrotate.conf

as root. This causes a new rotation, rather than having to wait for
it.

After this, you should see:

[EMAIL PROTECTED]:~$ ls -l /var/log/xdm.log*
-rw-r-----  1 root adm    0 Mar 25 23:16 /var/log/xdm.log
-rw-r-----  1 root adm 1573 Mar 25 23:16 /var/log/xdm.log.1.gz

[EMAIL PROTECTED]:~$ sudo lsof | grep var/log/xdm
xdm        1965      root    2w      REG        3,6       8376     179574 
/var/log/xdm.log.1 (deleted)
XFree86    2023      root    2w      REG        3,6       8376     179574 
/var/log/xdm.log.1 (deleted)
xdm        2024      root    2w      REG        3,6       8376     179574 
/var/log/xdm.log.1 (deleted)

xdm will now proceed to log into this deleted file. Eventually
xdm.log.1.gz will be rotated out of existance, and xdm will continue
logging into the deleted file, leaving you with no xdm logs at all.

> > That's the worst logrotate file I've seen in quite a while.
> 
> What looks wrong with it?
> 
> http://necrotic.deadbeast.net/svn/xfree86/trunk/debian/xdm.logrotate
> 
> /var/log/xdm.log {
>       notifempty
>       missingok
> }

No 'delaycompress'. No 'postrotate' to tell xdm to reopen the
file. And it relies on /etc/logrotate.conf for most of its values,
which is kinda sloppy. A more normal logrotate entry looks like this:

/var/log/apache/*.log {
        weekly
        missingok
        rotate 52
        compress
        delaycompress
        notifempty
        create 640 root adm
        sharedscripts
        postrotate
           if [ -f /var/run/apache.pid ]; then \
             if [ -x /usr/sbin/invoke-rc.d ]; then \
                invoke-rc.d apache reload > /dev/null; \
             else \
                /etc/init.d/apache reload > /dev/null; \
             fi; \
           fi;
        endscript
}

-- 
  .''`.  ** Debian GNU/Linux ** | Andrew Suffield
 : :' :  http://www.debian.org/ |
 `. `'                          |
   `-             -><-          |

Attachment: signature.asc
Description: Digital signature

Reply via email to