Results 1 to 7 of 7

Thread: 8.04 VPS Logs not rotating

  1. #1
    Join Date
    May 2007
    Location
    NY's first capital
    Beans
    2,868
    Distro
    Ubuntu 20.04 Focal Fossa

    8.04 VPS Logs not rotating

    I have been trying to determine the cause for logs not rotating.

    Syslog is not rotating at all.

    logrotate will only work if I manually run the command. It originally would not work at all, until first running it with force command. Now force command is not needed, but I still have to run it manually.

    How can I easily verify cron daily is running? I see it listed when running top.

    Some Info:

    Code:
    ls -alt cron.daily
    total 24
    drwxr-xr-x 77 root root 4096 2010-04-29 21:15 ..
    drwxr-xr-x  2 root root 4096 2010-04-06 13:31 .
    -rwxr-xr-x  1 root root  904 2010-01-02 10:45 spamassassin
    -rwxr-xr-x  1 root root 1154 2009-12-04 13:18 ntp
    -rwxr-xr-x  1 root root   89 2008-10-09 13:14 logrotate
    -rwxr-xr-x  1 root root 1309 2007-11-23 04:06 sysklogd
    Code:
    /etc$ cat cron.daily/logrotate
    #!/bin/sh
    
    test -x /usr/sbin/logrotate || exit 0
    /usr/sbin/logrotate /etc/logrotate.conf
    Code:
    cat cron.daily/sysklogd
    #! /bin/sh
    
    # sysklogd	Cron script to rotate system log files daily.
    #
    #		If you want to rotate other logfiles daily, edit
    #		this script.  An easy way is to add files manually,
    #		to add -a (for all log files) to syslogd-listfiles and
    #		add some grep stuff, or use the -s pattern argument to
    #		specify files that must not be listed.
    #
    #		This is a configration file.  You are invited to edit
    #		it and maintain it on your own.  You'll have to do
    #		that if you don't like the default policy
    #		wrt. rotating logfiles (i.e. with large logfiles
    #		weekly and daily rotation may interfere).  If you edit
    #		this file and don't let dpkg upgrade it, you have full
    #		control over it.  Please read the manpage to
    #		syslogd-listfiles.
    #
    #		Written by Martin Schulze <joey@debian.org>.
    #		$Id: cron.daily,v 1.14 2007-05-28 16:33:34 joey Exp $
    
    test -x /usr/sbin/syslogd-listfiles || exit 0
    test -x /sbin/syslogd || exit 0
    test -f /usr/share/sysklogd/dummy || exit 0
    
    USER=$(ps -C syslogd -o user= | head -n 1)
    [ -z "${USER}" ] && USER="root" || true
    
    set -e
    
    cd /var/log
    
    logs=$(syslogd-listfiles)
    
    test -n "$logs" || exit 0
    
    for LOG in $logs
    do
       if [ -s $LOG ]; then
          savelog -g adm -m 640 -u ${USER} -c 7 $LOG >/dev/null
       fi
    done
    
    # Restart syslogd
    #
    /etc/init.d/sysklogd reload-or-restart > /dev/null

    Code:
    sudo /usr/sbin/syslogd-listfiles --weekly
    /var/log/mail.warn
    /var/log/user.log
    /var/log/daemon.log
    /var/log/messages
    /var/log/debug
    /var/logauth.log
    /var/logmail.err
    /var/log/mail.log
    /var/log/kern.log
    /var/log/lpr.log
    /var/log/mail.info

    I also added this, which is the only mod I made.

    Code:
    cat logrotate.d/webcit
    /var/log/mail.* {
    	weekly
    	missingok
    	rotate 7
    	sharedscripts
    	postrotate
    		[ ! -f /var/run/syslogd.pid ] || kill -HUP `cat /var/run/syslogd.pid`
    	endscript
    	compress
    	notifempty
    }
    Any and all help is appreciated.

    So I think logrotate may work, it is possible cron is the fault?
    Nothing is ever easy, but if it is difficult you must be doing it wrong.

  2. #2
    Join Date
    May 2007
    Location
    NY's first capital
    Beans
    2,868
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: 8.04 VPS Logs not rotating

    I really wish I could get a reply to some of my threads.

    Nothing is ever easy, but if it is difficult you must be doing it wrong.

  3. #3
    Join Date
    May 2007
    Location
    NY's first capital
    Beans
    2,868
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: 8.04 VPS Logs not rotating

    Wow, my head hurts.

    I have been having a hell of a time. The only threads similar, seem to be unanswered.

    I may be on the right track now. I think the issue is anancron itself. I don't think it is executing. Here is why I think this is the issue. I am comparing my VPS 8.04 server with the issue, against my 9.04 desktop with perfect log rotation.

    with lots of searching, I came across a thread where the anancron script was not in /etc/cron.d. I have this file on my 9.04, but not on the server. I copied over the file, now I'll wait and see if there is any change.

    Logs from working desktop...I don't get these entries on the server:

    Code:
    May 10 07:58:05 T43 anacron[5194]: Job `cron.daily' terminated
    May 10 07:58:05 T43 anacron[5194]: Job `cron.weekly' started
    
    May 11 07:04:36 T43 anacron[3060]: Will run job `cron.daily' in 5 min.
    May 11 07:04:36 T43 anacron[3060]: Jobs will be executed sequentially
    On the server it looks like this:

    Code:
    Mar 10 03:19:01 server /USR/SBIN/CRON[5278]: (root) CMD (test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ))
    
    Mar 21 01:00:01 server /USR/SBIN/CRON[20226]: (root) CMD (test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly ))
    Nothing is ever easy, but if it is difficult you must be doing it wrong.

  4. #4
    Join Date
    May 2007
    Location
    NY's first capital
    Beans
    2,868
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: 8.04 VPS Logs not rotating

    It seems adding the anacron entry to /etc/cron.d worked

    Two things I noticed. cron.daily did not run at the expected time.

    Code:
    cat /etc/crontab
    # /etc/crontab: system-wide crontab
    # Unlike any other crontab you don't have to run the `crontab'
    # command to install the new version when you edit this file
    # and files in /etc/cron.d. These files also have username fields,
    # that none of the other crontabs do.
    
    SHELL=/bin/sh
    PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
    
    # m h dom mon dow user	command
    7 * * * * root    cd / && run-parts --report /etc/cron.hourly
    19 3 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
    0 1 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
    51 4 25 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
    #
    I would have expected cron.daily to run at 03:19 this morning.

    Is it possible it started at that time and did not finish until 07:40?
    I did have some rather large logs, but four hours seems excessive.

    Code:
    grep anacron /var/log/syslog | tail -10
    May 12 07:35:13 server anacron[15890]: Job `cron.daily' terminated (mailing output)
    May 12 07:35:14 server anacron[15890]: Tried to mail output of job `cron.daily', but mailer process (/usr/sbin/sendmail) exited with ststus 7
    May 12 07:40:01 server anacron[15890]: Job `cron.weekly' started
    May 12 07:40:01 server anacron[15890]: Job `cron.weekly' terminated
    May 12 07:45:01 server anacron[15890]: Job `cron.monthly' started
    May 12 07:45:05 server anacron[15890]: Job `cron.monthly' terminated
    May 12 07:45:05 server anacron[15890]: Normal exit (3 jobs run)
    The second thing I noticed, it compressed already compressed files. Perhaps this is because of running logrotate manually in the past. I will wait it out and see if future jobs run correctly.

    Code:
    -rw-r-----  1 mysql  adm         20 2010-04-14 07:09 mysql.log.1.gz
    -rw-r-----  1 syslog adm    1990732 2010-04-14 07:09 mail.info.1.gz.1.gz
    -rw-r-----  1 syslog adm     663208 2010-04-14 07:09 mail.info.2.gz
    -rw-r--r--  1 syslog adm    5847896 2010-04-14 07:09 mail.log.1.gz.1.gz
    -rw-r--r--  1 syslog adm    1777917 2010-04-14 07:09 mail.log.2.gz
    -rw-r-----  1 syslog adm       4738 2010-04-14 06:35 mail.warn.1.gz.1.gz
    -rw-r-----  1 syslog adm       1005 2010-04-14 06:35 mail.warn.2.gz
    Notice the double .gz extensions on the older compressed logs. Hmn, looking at the time stamps, it appears this happend back in April, I guess I never noticed it.

    Dare I ask why the anacron entry was not already there. Perhaps the VPS build at my provider has a bug?
    Nothing is ever easy, but if it is difficult you must be doing it wrong.

  5. #5
    Join Date
    Oct 2010
    Beans
    5
    Distro
    Ubuntu 10.04 Lucid Lynx

    10.04 VPS Logs not rotating either

    Similarly, I had the same issue with my VPS Ubuntus (10.04 LTS). I have one which was installed several months ago, which has a 1.1GB syslog file, and another fresh install from earlier today. Neither had anacron running, nor could anacron start. The solution was:

    Code:
    sudo mv /etc/init.removed/anacron.conf /etc/init/ 
    sudo start anacron
    Detailed info at https://bugs.launchpad.net/ubuntu/+s...on/+bug/793832

  6. #6
    Join Date
    May 2010
    Beans
    50

    Re: 10.04 VPS Logs not rotating either

    Quote Originally Posted by clancyhood View Post
    Similarly, I had the same issue with my VPS Ubuntus (10.04 LTS). I have one which was installed several months ago, which has a 1.1GB syslog file, and another fresh install from earlier today. Neither had anacron running, nor could anacron start. The solution was:

    Code:
    sudo mv /etc/init.removed/anacron.conf /etc/init/ 
    sudo start anacron
    Detailed info at https://bugs.launchpad.net/ubuntu/+s...on/+bug/793832
    I have been having problems with logrotate on 10.04.2. This file was not in that directory, I have tried the above and I will report back.

  7. #7
    Join Date
    May 2010
    Beans
    50

    Re: 10.04 VPS Logs not rotating either

    This did not fix my problem, logrotate is still not working.
    Last edited by jamesa00789; June 13th, 2011 at 12:42 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •