Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to force logfile rotation using logrotate -f /var/log/syslog, but it's only return tones of:

error: syslog:1 unknown option 'May' -- ignoring line
error: syslog:1 unexpected text

I know that on this system rsyslogd is running. How to rotate /var/log/syslog? I want it empty.

share|improve this question
up vote 11 down vote accepted

You don't tell logrotate which file to rotate on the command line. You pass it a configuration file. So in your case, logrotate is reading /var/log/syslog and trying to parse it as a config file and failing (hence your errors).

If you want to rotate /var/log/syslog it needs to be listed in a logrotate config file somewhere, and you just run logrotate. If it rotated recently, then logrotate -f to force it to do it again.

Here's an example entry for /var/log/syslog from Debian,

        rotate 7
                invoke-rc.d rsyslog reload > /dev/null

So, you need that in a file, normally either /etc/logrotate.conf or as a file snippet in /etc/logrotate.d assuming your /etc/logrotate.conf points there, and then you just run logrotate /etc/logrotate.conf.

Since you're running Debian, this is probably all in place, and all you need to actually do is run logrotate -f /etc/logrotate.conf (note, this will rotate every log currently configured in logrotate).

If you truly only want to rotate /var/log/syslog, you will need to create a config file that just does that one log, based on the content of /etc/logrotate.conf + /etc/logrotate.d/rsyslog.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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