0

I want to rotate the syslog for testing.

sudo logrotate -f /var/log/syslog
[sudo] password for stephen: 
error: Ignoring /var/log/syslog because the file owner is wrong (should be root or user with uid 0).

Owner is like this :

ll /var/log/syslog
-rw-r----- 1 syslog adm 268K 2020-08-01 08:39 /var/log/syslog

Okay but let's try with a root shell.

#echo $UID
0
#logrotate -f /var/log/syslog
error: Ignoring /var/log/syslog because the file owner is wrong (should be root or user with uid 0).

Where is the error? What is the workaround?

1

Usage: logrotate [-dfv?] [-d|--debug] [-f|--force] [-m|--mail=command] [-s|--state=statefile] [-v|--verbose] [-l|--log=logfile] [--version] [-?|--help] [--usage] [OPTION...] < configfile >

sudo logrotate -f /etc/logrotate.conf

It has to be run on a config file... This will run logrotate on all the logs designated by the config.

| improve this answer | |
  • you're not actually changing the configuration.. you are just running the force the way it is designed, and it forces all of the logs to rotate that are noted in the configuration. – WU-TANG Aug 1 at 18:39
  • You could run it on individual files in /etc/logrotate.d/ ... but i got undesired results when I did that. you'd have to play with it to figure out how to get the results you want... I did have to make a change when I tried that, /var/log/ permissions had to be 755... But I was ending up with the new syslog file not being created after it archived the current one. With that said, I didn't dive that deep into it... – WU-TANG Aug 1 at 18:41
  • Thanks. I've decided on another approach for my testing but this is good to know. – Stephen Boston Aug 1 at 18:51

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.