Re: Logrotate Question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2008-06-13 at 14:12 +0000, Ian Lists wrote:
> I am trying to have logroate archive logs into a dynamic directory structure.  I can 't seem to get the following logroate script to work and I don't know if it is really possible.  It does not seem that the "olddir" option supports variables?  Does anyone have any advice on how to get this completed.
> 
> This is the error I get.
> error: /etc/logrotate.d/test:6 bad olddir path "/opt/`date +%Y/%m/%d`"
> 
> ######################################################################
> /opt/netlogs/live/*.log {
>         daily
>         prerotate
>                 /bin/mkdir -p "/opt/`date +%Y/%m/%d`"
>         endscript
>         olddir "/opt/`date +%Y/%m/%d`"
>         sharedscripts
>         missingok
>         postrotate
>                  /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
>                  /bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true
>         endscript
> }
> #########################################################################

I am not sure about logrotate's ability to shell out to run random
commands, but what you could do is write a shell script to build this
file with the values needed, cron it to run at say 11am, let logrotate
run and then nuke the file.  It is certainly a hack, but it would work.

Pat


-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux