[syslog-ng] Logrotate Not Rotating All - Need Help Matching Rules

Hari Sekhon hpsekhon at googlemail.com
Wed May 7 14:00:05 CEST 2008


Quick workaround:

Write a bash script to generate your logrotate files just before your 
logrotate is called by looking at what files exist. This will then 
logrotate all your dynamic files that exist at the time. You might want 
to have this script delete the logrotate configs for files which no 
longer exist as well if using one config per file... although I think it 
would be easier to have one big auto-generated config for all those 
dynamic files and have it replaced by the script once a day just before 
logrotate is run...

-h

-- 
Hari Sekhon


wiskbroom at hotmail.com wrote:
>
>     My logrotate.d/syslog-ng file contains a few entries for many
>     different logs, see below.
>
>     My syslog-ng.conf automatically creates entries for many different
>     hosts, each with unique hostnames, depending on their purpose. 
>     The "purpose" for the hosts each have a different subdir under
>     /var/log/Myhosts/, i.e. /var/log/Myhosts/Switches and
>     /var/log/Myhosts/Firewalls.
>
>     Logrotate does not work unless I've added each host separately
>     under my logrotate conf, which is impossible since I dynamically
>     create these entries via mysyslog-ng.conf .
>
>     Any help greatly appreciated.
>
>     .vp
>
>     /var/log/Myhosts/*/*.log \
>     /var/log/Myhosts/Switches/*/*.log \
>     /var/log/Myhosts/*.log /var/log/messages \
>     /var/log/secure \
>     /var/log/maillog \
>     /var/log/spooler \
>     /var/log/boot.log \
>     /var/log/cron \
>     /var/log/mail/* {
>             missingok
>             weekly
>             rotate 4
>             create
>             compress
>             copytruncate
>             ifempty
>     #    olddir /var/log/Myhosts/Archived-Logs/
>             sharedscripts
>             postrotate
>             sharedscripts
>             postrotate
>                     n/kill -HUP `cat /var/run/syslog-ng.pid 2>
>     /dev/null` 2> /dev/null || true
>             endscript
>



More information about the syslog-ng mailing list