Apache Logrotate Question

I'm trying to set up logrotate now. I have some questions.

First, should I pipe the logfile through logrotate, like this (in sites-enabled)

CustomLog "|bin/rotatelogs /srv/www/realfreemarket.org/logs/access.log 86400

_Or, should I explicitly call logrotate as a cron job?

Also, I'd like to keep my logs in the form access.YYYY.MM.DD.log, and keep them for at least a month or two. How do I do that?_

2 Replies

It's silly to answer my own question, but I figured it out. I changed it to:

CustomLog "|/usr/sbin/rotatelogs -l /srv/www/realfreemarket.org/logs/access

.%Y.%m.%d.log 86400" combined

ubuntu puts "rotatelogs" in "/usr/sbin" instead of "/bin".

It is not so silly as it may seem, you answer helped me! Thanks!


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct