RE: Questions About Logrotate

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: David Demland
Date:  
To: plug-discuss
Subject: RE: Questions About Logrotate
I changed the user and the group from proxy to squid. This did not seem to
help. Here is an excerpt of the output from last night's run:

1 run-parts: executing /etc/cron.daily/bsdmainutils
2 run-parts: executing /etc/cron.daily/exim
3 /etc/cron.daily/exim:
4 chmod: cannot access `/var/log/exim/paniclog.new': No such file or
directory
5 mv: cannot stat `/var/log/exim/paniclog.new': No such file or directory
6 run-parts: executing /etc/cron.daily/find
7 run-parts: executing /etc/cron.daily/logrotate
8 Starting Logrotate
9 Starting Logrotate
10 reading config file /etc/logrotate.conf
11 including /etc/logrotate.d
12 reading config file base-config
13 reading config info for /var/log/installer.log
14 reading config info for /var/log/installer.timings
15 reading config file dansguardian
16 reading config info for /var/log/dansguardian/access.log
17 reading config file /etc/logrotate.conf
18 including /etc/logrotate.d
19 reading config file base-config
20 reading config info for /var/log/installer.log
21 reading config info for /var/log/installer.timings
22 reading config file dansguardian
23 reading config info for /var/log/dansguardian/access.log
24 reading config file squid
25 reading config file squid
26 reading config info for /var/log/squid/*.log
27 reading config info for /var/log/wtmp
28 reading config info for /var/log/btmp
29 reading config info for /var/log/squid/*.log
30 reading config info for /var/log/wtmp
31 reading config info for /var/log/btmp

I am at a lost over lines 8 and 9. These two lines seem to show that the
logrotate script is being called two times. Yet the crontab looks like:

# /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.
# This file also has a username field, 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
17 *    * * *   root    run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || run-parts -v --report
/etc/cron.daily  >> /home/dansguardian/LogRotateOutPut 2>&1
47 6    * * 7   root    test -x /usr/sbin/anacron || run-parts --report
/etc/cron.weekly
52 6    1 * *   root    test -x /usr/sbin/anacron || run-parts --report
/etc/cron.monthly
#


and the cron.daily directory looks like:

-rwxr-xr-x 1 root root 86 Sep 27 2001 modutils
-rwxr-xr-x 1 root root 495 Nov 18 2001 netkit-inetd
-rwxr-xr-x 1 root root 502 Jul 4 2002 bsdmainutils
-rwxr-xr-x 1 root root 2571 Jul 28 2004 standard
-rwxr-xr-x 1 root root 1307 Nov 7 05:13 sysklogd
-rwxr-xr-x 1 root root 419 Nov 21 03:10 find
-rwxr-xr-x 1 root root 946 Jan 5 09:30 man-db
-rwxr-xr-x 1 root root 527 Jan 9 05:10 exim
-rwxr-xr-x 1 root root 197 Mar 20 19:52 logrotate

and the cron.weekly looks like:

-rwxr-xr-x 1 root root 1092 Nov 7 05:13 sysklogd
-rwxr-xr-x 1 root root 520 Jan 5 09:30 man-db

The logrotate looks like:

#!/bin/sh

test -x /usr/sbin/logrotate || exit 0
echo Starting Logrotate >> /home/dansguardian/LogRotateOutPut
/usr/sbin/logrotate -v /etc/logrotate.conf >>
/home/dansguardian/LogRotateOutPut 2>&1

The cron configuration does not show an overlay that would call the
logrotate two times. Yet because of the "Starting Logrotate" appearing in
the output two times, it would lead to the conclusion that the logrotate
script is being called twice. Can anyone help me to understand how this
could be happening?

Thank You,

David

-----Original Message-----
From:
[mailto:plug-discuss-admin@lists.plug.phoenix.az.us]On Behalf Of Craig
White
Sent: Sunday, March 20, 2005 11:37 AM
To:
Subject: Re: Questions About Logrotate


On Sun, 2005-03-20 at 10:59 -0700, David Demland wrote:
> My logrotate.conf file looks like:
>
> # 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
>
> # packages drop log rotation information into this directory
> include /etc/logrotate.d
>
> # no packages own wtmp, or btmp -- we'll rotate them here
> /var/log/wtmp {
>     missingok
>     monthly
>     create 0664 root utmp
>     rotate 1
> }

>
> /var/log/btmp {
>     missingok
>     monthly
>     create 0664 root utmp
>     rotate 1
> }

>
> # system-specific logs may be configured here
>
> The logrotate.d directory looks like:
>
> ls -ltr /etc/logrotate.d/
> total 12
> -rw-r--r-- 1 root root 380 May 1 2002 base-config
> -rw-r--r-- 1 root root 301 Feb 4 17:59 squid
> -rw-r--r-- 1 root root 650 Mar 16 09:23 dansguardian
>
> The dansguardian looks like:
>
> cat /etc/logrotate.d/dansguardian
> /var/log/dansguardian/access.log {
>         rotate 5
>         daily
>         prerotate
>                 echo Starting Log Rotoate >>
> /home/dansguardian/LogRotateOutPut
>                 date >> /home/dansguardian/LogRotateOutPut
>                 echo Stopping DansGuardian >>
> /home/dansguardian/LogRotateOutPut
>                 /etc/init.d/dansguardian stop >>
> /home/dansguardian/LogRotateOutPut 2>&1 || true
>                 echo Running Report >> /home/dansguardian/LogRotateOutPut
>  > /home/dansguardian/LogRotateOutPut 2>&1
>         endscript
>         postrotate
>                 echo Starting DansGuardian >>
> /home/dansguardian/LogRotateOutPut
>                 sleep 2 && /etc/init.d/dansguardian start >>
> /home/dansguardian/LogRotateOutPut 2>&1
>         endscript
> }

>
> Yet when the cron does a run-parts I get the following output:
>
> run-parts: executing /etc/cron.daily/bsdmainutils
> run-parts: executing /etc/cron.daily/exim
> run-parts: executing /etc/cron.daily/find
> run-parts: executing /etc/cron.daily/logrotate
> reading config file /etc/logrotate.conf
> including /etc/logrotate.d
> reading config file base-config
> reading config info for /var/log/installer.log
> reading config info for /var/log/installer.timings
> reading config file dansguardian
> reading config info for /var/log/dansguardian/access.log
> reading config file squid
> reading config file /etc/logrotate.conf
> including /etc/logrotate.d
> reading config file base-config
> reading config info for /var/log/installer.log
> reading config info for /var/log/installer.timings
> reading config file dansguardian
> reading config info for /var/log/dansguardian/access.log
> reading config file squid
> reading config info for /var/log/squid/*.log
> reading config info for /var/log/wtmp
> reading config info for /var/log/btmp
> reading config info> reading config info for /var/log/wtmp
> reading config info for /var/log/btmp
>
> Handling 6 logs
>
> rotating pattern: /var/log/installer.log weekly (4 rotations)
> empty log files are rotated, old logs are removed
> considering log /var/log/installer.log
> log /var/log/installer.log does not exist -- skipping
>
> rotating pattern: /var/log/installer.timings weekly (4 rotations)
> empty log files are rotated, old logs are removed
> considering log /var/log/installer.timings
> log /var/log/installer.timings does not exist -- skipping
>
> rotating pattern: /var/log/dansguardian/access.log after 1 days (5
> rotations)
> empty log files are rotated, old logs are removed
> considering log /var/log/dansguardian/access.log
> log needs rotating
> rotating log /var/log/dansguardian/access.log, log->rotateCount is 5
> renaming /var/log/dansguardian/access.log.5 to
> /var/log/dansguardian/access.log.6 (rotatecount 5, logstart 1, i 5),
> old log /var/log/dansguardian/access.log.5 does not exist
> renaming /var/log/dansguardian/access.log.4 to
> /var/log/dansguardian/access.log.5 (rotatecount 5, logstart 1, i 4),
> old log /var/log/dansguardian/access.log.4 does not exist
> renaming /var/log/dansguardian/access.log.3 to
> /var/log/dansguardian/access.log.4 (rotatecount 5, logstart 1, i 3),
> old log /var/log/dansguardian/access.log.3 does not exist
> renaming /var/log/dansguardian/access.log.2 to
> /var/log/dansguardian/access.log.3 (rotatecount 5, logstart 1, i 2),
> old log /var/log/dansguardian/access.log.2 does not exist
> renaming /var/log/dansguardian/access.log.1 to
> /var/log/dansguardian/access.log.2 (rotatecount 5, logstart 1, i 1),
> old log /var/log/dansguardian/access.log.1 does not exist
> renaming /var/log/dansguardian/access.log.0 to
> /var/log/dansguardian/access.log.1 (rotatecount 5, logstart 1, i 0),
> old log /var/log/dansguardian/access.log.0 does not exist
> log /var/log/dansguardian/access.log.6 doesn't exist -- won't try to

dispose
> of it
> running prerotate script
>
> Handling 6 logs
>
> rotating pattern: /var/log/installer.log weekly (4 rotations)
> empty log files are rotated, old logs are removed
> considering log /var/log/installer.log
> log /var/log/installer.log does not exist -- skipping
>
> rotating pattern: /var/log/installer.timings weekly (4 rotations)
> empty log files are rotated, old logs are removed
> considering log /var/log/installer.timings
> log /var/log/installer.timings does not exist -- skipping
>
> rotating pattern: /var/log/dansguardian/access.log after 1 days (5
> rotations)
> empty log files are rotated, old logs are removed
> considering log /var/log/dansguardian/access.log
> log needs rotating
> rotating log /var/log/dansguardian/access.log, log->rotateCount is 5
> renaming /var/log/dansguardian/access.log.5 to
> /var/log/dansguardian/access.log.6 (rotatecount 5, logstart 1, i 5),
> old log /var/log/dansguardian/access.log.5 does not exist
> renaming /var/log/dansguardian/access.log.4 to
> /var/log/dansguardian/access.log.5 (rotatecount 5, logstart 1, i 4),
> old log /var/log/dansguardian/access.log.4 does not exist
> renaming /var/log/dansguardian/access.log.3 to
> /var/log/dansguardian/access.log.4 (rotatecount 5, logstart 1, i 3),
> old log /var/log/dansguardian/access.log.3 does not exist
> renaming /var/log/dansguardian/access.log.2 to
> /var/log/dansguardian/access.log.3 (rotatecount 5, logstart 1, i 2),
> old log /var/log/dansguardian/access.log.2 does not exist
> renaming /var/log/dansguardian/access.log.1 to
> /var/log/dansguardian/access.log.2 (rotatecount 5, logstart 1, i 1),
> old log /var/log/dansguardian/access.log.1 does not exist
> renaming /var/log/dansguardian/access.log.0 to
> /var/log/dansguardian/access.log.1 (rotatecount 5, logstart 1, i 0),
> old log /var/log/dansguardian/access.log.0 does not exist
> log /var/log/dansguardian/access.log.6 doesn't exist -- won't try to

dispose
> of it
> running prerotate script
> Starting Log Rotoate
> Sun Mar 20 06:25:20 MST 2005
> Stopping DansGuardian
> Stopping DansGuardian: Starting Log Rotoate
> Sun Mar 20 06:25:20 MST 2005
> Stopping DansGuardian
> Stopping DansGuardian: dansguardian.
> Running Report
> dansguardian.
> Running Report
> renaming /var/log/dansguardian/access.log to
> /var/log/dansguardian/access.log.1
> creating new log mode = 0644 uid = 102 gid = 102
> running postrotate script
> Starting DansGuardian
> renaming /var/log/dansguardian/access.log to
> /var/log/dansguardian/access.log.1
> creating new log mode = 0644 uid = 102 gid = 102
> running postrotate script
> Starting DansGuardian
> Starting DansGuardian: Starting DansGuardian: Error listening to server
> socketdansguardian.
>
> Exiting with error
>
> rotating pattern: /var/log/squid/*.log after 1 days (2 rotations)
> empty log files are rotated, old logs are removed
> considering log /var/log/squid/access.log
> log needs rotating
> considering log /var/log/squid/cache.log
> log needs rotating
> considering log /var/log/squid/store.log
> log needs rotating
> running shared prerotate script
> error: error running postrotate script
>
> rotating pattern: /var/log/squid/*.log after 1 days (2 rotations)
> empty log files are rotated, old logs are removed
> considering log /var/log/squid/access.log
> log needs rotating
> considering log /var/log/squid/cache.log
> log needs rotating
> considering log /var/log/squid/store.log
> log needs rotating
> running shared prerotate script
> rotating log /var/log/squid/access.log, log->rotateCount is 2
> rotating log /var/log/squid/access.log, log->rotateCount is 2
> previous log /var/log/squid/access.log.1 does not exist
> renaming /var/log/squid/access.log.2.gz to /var/log/squid/access.log.3.gz
> (rotatecount 2, logstart 1, i 2),
> renaming /var/log/squid/access.log.1.gz to /var/log/squid/access.log.2.gz
> (rotatecount 2, logstart 1, i 1),
> old log /var/log/squid/access.log.1.gz does not exist
> renaming /var/log/squid/access.log.0.gz to /var/log/squid/access.log.1.gz
> (rotatecount 2, logstart 1, i 0),
> old log /var/log/squid/access.log.0.gz does not exist
> renaming /var/log/squid/access.log to /var/log/squid/access.log.1
> removing old log /var/log/squid/access.log.3.gz
> rotating log /var/log/squid/cache.log, log->rotateCount is 2
> previous log /var/log/squid/cache.log.1 does not exist
> renaming /var/log/squid/cache.log.2.gz to /var/log/squid/cache.log.3.gz
> (rotatecount 2, logstart 1, i 2),
> renaming /var/log/squid/cache.log.1.gz to /var/log/squid/cache.log.2.gz
> (rotatecount 2, logstart 1, i 1),
> old log /var/log/squid/cache.log.1.gz does not exist
> renaming /var/log/squid/cache.log.0.gz to /var/log/squid/cache.log.1.gz
> (rotatecount 2, logstart 1, i 0),
> old log /var/log/squid/cache.log.0.gz does not exist
> renaming /var/log/squid/cache.log to /var/log/squid/cache.log.1
> removing old log /var/log/squid/cache.log.3.gz
> rotating log /var/log/squid/store.log, log->rotateCount is 2
> previous log /var/log/squid/store.log.1 does not exist
> renaming /var/log/squid/store.log.2.gz to /var/log/squid/store.log.3.gz
> (rotatecount 2, logstart 1, i 2),
> renaming /var/log/squid/store.log.1.gz to /var/log/squid/store.log.2.gz
> (rotatecount 2, logstart 1, i 1),
> old log /var/log/squid/store.log.1.gz does not exist
> renaming /var/log/squid/store.log.0.gz to /var/log/squid/store.log.1.gz
> (rotatecount 2, logstart 1, i 0),
> old log /var/log/squid/store.log.0.gz does not exist
> renaming /var/log/squid/store.log to /var/log/squid/store.log.1
> removing old log /var/log/squid/store.log.3.gz
> running shared postrotate script
> compressing log with: /bin/gzip
> renaming /var/log/squid/access.log.2.gz to /var/log/squid/access.log.3.gz
> (rotatecount 2, logstart 1, i 2),
> old log /var/log/squid/access.log.2.gz does not exist
> renaming /var/log/squid/access.log.1.gz to /var/log/squid/access.log.2.gz
> (rotatecount 2, logstart 1, i 1),
> renaming /var/log/squid/access.log.0.gz to /var/log/squid/access.log.1.gz
> (rotatecount 2, logstart 1, i 0),
> old log /var/log/squid/access.log.0.gz does not exist
> log /var/log/squid/access.log.3.gz doesn't exist -- won't try to dispose

of
> it
> renaming /var/log/squid/access.log to /var/log/squid/access.log.1
> error: failed to rename /var/log/squid/access.log to
> /var/log/squid/access.log.1: No such file or directory
> rotating log /var/log/squid/cache.log, log->rotateCount is 2
> compressing log with: /bin/gzip
> renaming /var/log/squid/cache.log.2.gz to /var/log/squid/cache.log.3.gz
> (rotatecount 2, logstart 1, i 2),
> old log /var/log/squid/cache.log.2.gz does not exist
> renaming /var/log/squid/cache.log.1.gz to /var/log/squid/cache.log.2.gz
> (rotatecount 2, logstart 1, i 1),
> renaming /var/log/squid/cache.log.0.gz to /var/log/squid/cache.log.1.gz
> (rotatecount 2, logstart 1, i 0),
> old log /var/log/squid/cache.log.0.gz does not exist
> log /var/log/squid/cache.log.3.gz doesn't exist -- won't try to dispose of
> it
> renaming /var/log/squid/cache.log to /var/log/squid/cache.log.1
> error: failed to rename /var/log/squid/cache.log to
> /var/log/squid/cache.log.1: No such file or directory
> rotating log /var/log/squid/store.log, log->rotateCount is 2
> compressing log with: /bin/gzip
>
> rotating pattern: /var/log/wtmp monthly (1 rotations)
> empty log files are rotated, old logs are removed
> considering log /var/log/wtmp
> log does not need rotating
>
> rotating pattern: /var/log/btmp monthly (1 rotations)
> empty log files are rotated, old logs are removed
> considering log /var/log/btmp
> log does not need rotating
> run-parts: executing /etc/cron.daily/man-db
> renaming /var/log/squid/store.log.2.gz to /var/log/squid/store.log.3.gz
> (rotatecount 2, logstart 1, i 2),
> old log /var/log/squid/store.log.2.gz does not exist
> renaming /var/log/squid/store.log.1.gz to /var/log/squid/store.log.2.gz
> (rotatecount 2, logstart 1, i 1),
> renaming /var/log/squid/store.log.0.gz to /var/log/squid/store.log.1.gz
> (rotatecount 2, logstart 1, i 0),
> old log /var/log/squid/store.log.0.gz does not exist
> log /var/log/squid/store.log.3.gz doesn't exist -- won't try to dispose of
> it
> renaming /var/log/squid/store.log to /var/log/squid/store.log.1
> error: failed to rename /var/log/squid/store.log to
> /var/log/squid/store.log.1: No such file or directory
> running shared postrotate script
>
> rotating pattern: /var/log/wtmp monthly (1 rotations)
> empty log files are rotated, old logs are removed
> considering log /var/log/wtmp
> log does not need rotating
>
> rotating pattern: /var/log/btmp monthly (1 rotations)
> empty log files are rotated, old logs are removed
> considering log /var/log/btmp
> log does not need rotating
> run-parts: executing /etc/cron.daily/modutils
> /etc/cron.daily/modutils:
> rm: cannot remove `/var/log/ksymoops/20050316.log': No such file or
> directory
> find: /var/log/ksymoops/20050316091610.ksyms: No such file or directory
> find: /var/log/ksymoops/20050316062610.ksyms: No such file or directory
> find: /var/log/ksymoops/20050316062610.modules: No such file or directory
> find: /var/log/ksymoops/20050316091610.modules: No such file or directory
> find: /var/log/ksymoops/20050316091611.ksyms: No such file or directory
> find: /var/log/ksymoops/20050316091611.modules: No such file or directory
> find: /var/log/ksymoops/20050316091612.ksyms: No such file or directory
> find: /var/log/ksymoops/20050316091612.modules: No such file or directory
> find: /var/log/ksymoops/20050316091613.ksyms: No such file or directory
> find: /var/log/ksymoops/20050316091613.modules: No such file or directory
> find: /var/log/ksymoops/20050317062610.ksyms: No such file or directory
> find: /var/log/ksymoops/20050317062610.modules: No such file or directory
> run-parts: /etc/cron.daily/modutils exited with return code 1
> run-parts: executing /etc/cron.daily/netkit-inetd
> run-parts: executing /etc/cron.daily/standard
> run-parts: executing /etc/cron.daily/sysklogd
> /etc/cron.daily/sysklogd:
> mv: cannot stat `/var/log/syslog.new': No such file or directory
>
> My question: why is the including /etc/logrotate.d happening two times. I
> cna not see a reason. Can anyone help me see what I am missing.
>

----
guessing that the daily and the weekly scripts both ran last night

mkdir /var/log/ksymoops
mkdir /var/log/squid

chown uid_of_squid:gid_of_squid /var/log/squid -R

you will need to see what the uid is of the identity running squid

# grep squid /etc/passwd
squid:x:23:23::/var/spool/squid:/sbin/nologin

on a redhat system - RHEL 3 - squid is uid=23 and gid=23 YMMV

so the above command...

chown squid:squid /var/log/squid -R
or
chown 23:23 /var/log/squid -R

would fix the problems with squid logs

dansguardian logs seem ok - it seems that you don't have a full 6 days
of logs yet 'rotateCount=2'

squid will generally compress it's rotated logs - they are HUGE

I would have expected Dan's Guardian logs to compress too - evidently
not by default.

Craig

---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss

---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss