9

Not sure if this is possible at all.

And what about empty lines?

Update:

Testing the config with

logrotate -d /etc/logrotate.d/apache2

returns

error: /etc/logrotate.d/apache2:1 lines must begin with a keyword or a filename (possibly in double quotes)

for every empty line in the config file.

Original question about comment syntax is answered, though.

Update 2: This config now seems to work for me (note that it restarts apache after rotation):

/var/log/apache2/*.log {
    # https://stackoverflow.com/questions/26482773/apache-and-logrotate-configuration
    su root adm
    daily
    missingok
    rotate 14
    create 640 root adm
    # https://stackoverflow.com/questions/25845752/logrotate-suffix-dateext-rotate
    dateext
    dateformat -%Y-%m-%d.log
    sharedscripts
    postrotate
        systemctl restart apache2 || true
    endscript
}

1 Answers1

16
man logrotate

Note that comments may appear anywhere in the config file as long as the first non-whitespace character on the line is a #.

Ravexina
  • 57,256