Re: Questions About Logrotate

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Craig White
Date:  
To: plug-discuss
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/GetDGReport >>
> /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 for /var/log/squid/*.log
> 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