Adding a file to logrotate

5 posts / 0 new
Last post
#1 Thu, 10/01/2009 - 06:52
Hal9000

Adding a file to logrotate

Virtualmin sets up logrotation for each domain, which is fine. However, besides access_log and error_log i also have a php_log file, which logs all php notices/warnings/errors. Is it possible to tell Virtualmin to add this file to logrotate? Possibly, to all existing virtual servers as well? Cheers :)

Thu, 10/01/2009 - 08:54
andreychek

Howdy,

You can configure what's used for the log file rotation for each Virtual Server, by going into System Settings -> Server Templates -> Log File Rotation.

As far as re-configuring existing Virtual Servers, you could use the command line tool to disable the "logrotate" feature, then re-enable it. You can run "virtualmin disablefeature" for some more info on doing that.

-Eric

Thu, 10/01/2009 - 09:18
Hal9000

Disablind and re-enabling is a great idea ;) And I LOVE Virtualmin's command line API. Anyway, there is a problem with the System Settings -> Server Templates -> Log File Rotation thing, cause everything i put in there gets added inside the what it seems hard-coded brackets. so basically in the config i put this:

${HOME}/logs/access_log ${HOME}/logs/error_log ${HOME}/logs/php_log {
        rotate 5
        weekly
        compress
        postrotate
        /usr/sbin/apache2ctl graceful
        endscript
}

but now i get this in /etc/logrotate.conf:

/home/somedomain.tld/logs/access_log /home/somedomain.tld/logs/error_log {
    /home/somedomain.tld/logs/access_log /home/somedomain.tld/logs/error_log /home/somedomain.tld/logs/php_log {
        rotate 5
        weekly
        compress
        postrotate
        /usr/sbin/apache2ctl graceful
        endscript
    }
}

also, disabling the logrotate feature did not correctly remove all entries rom the logrotate.conf file, which is not that tragic, since i just removed them manually... but i guess it's a bug.

anyway, it seems I'm stuck with access_log and error_log files only, unless there is another way. anyone? :)

Fri, 10/09/2009 - 02:37 (Reply to #3)
Hal9000

bump :P

Fri, 10/09/2009 - 10:15
andreychek

Don't say "bump", it drive me insane :-) (pick some other phrase :-)

However, you have a point -- this all should be possible, as a person could certainly want to add something to log rotation for one or more Virtual Servers.

And in all my poking around, I just don't see a way to do that currently...

So my recommendation would be to file a bug report, and to tell Jamie what you told me -- that you have an additional file you want added to the log rotation for all your Virtual Servers, and to see what he recommends.

-Eric

Topic locked