Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
_
Server Fault is a question and answer Here's how it works:
site for system and network
administrators. Join them; it only takes a
minute:
Sign up Anybody can ask Anybody can The best answers are voted
a question answer 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:
1 Answer
You don't tell logrotate which file to rotate on the command line. You pass it a configuration
https://serverfault.com/questions/388573/manually-rotating-logfile-with-rsyslogd 1/2
10/16/2017 log files - manually rotating logfile with rsyslogd - Server Fault
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).
/var/log/syslog
{
rotate 7
daily
missingok
notifempty
delaycompress
compress
postrotate
invoke-rc.d rsyslog reload > /dev/null
endscript
}
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 .
https://serverfault.com/questions/388573/manually-rotating-logfile-with-rsyslogd 2/2