0

In a setup very much like: http://wiki.apache.org/httpd/ExtendingPrivilegeSeparation I have logs located in /var/weblog/<domain>/error_log

I would like to use logrotate to rotate these logs 50M, gzip the rest, and keep 5.

Instead of repeating the same section over and over again, I'm wondering if I can use something like:

/var/weblog/*/error_log {
    missingok
    rotate 5
    delaycompress
    compress
    size 50M
    sharedscripts
    postrotate
        /opt/bw/sbin/bw_apachectl.sh reload $1
    endscript
}

to match the domain and use it in the script.

0

I think the logrotate.conf man page answers this question quite nicely.

  • 1
    No, I didn't. My system doesn't have a logrotate.conf man page. I did however read logrotate(8), and it does not answer my question. There does not seem a possibility to do it. With logrotate, anyway. I was hoping for an answer of the kind "No, you can't do that with logrotate, but you can use zomgwtf," or: "Yes, you can do that with logrotate, using this little patch" ;) – Igor Galić Jan 27 '11 at 13:47
  • 1
    I think you'll find that appropriate man page is available online, too, and does answer your question. Cheers. – larsks Jan 27 '11 at 15:09
  • This is the source for logrotate.conf(5): svn.fedorahosted.org/svn/logrotate/trunk/logrotate.conf.5 -- it appear the answer is no. Which is why I've been looking into the source to add the feature – Igor Galić Jan 27 '11 at 15:26
-1

If you zap sharedscripts, you will get one full path to a logfile at a time -- your shell script for restarting the service would have to extract that one path segment on its own (the $1 is not just the part that the glob ate up)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.