Glam Prestige Journal

Bright entertainment trends with youth appeal.

Each my syslog file (and each new syslog) begins from this strings:

localhost rsyslogd: [origin software="rsyslogd" swVersion="8.2001.0" x-pid="451" x-info=""] rsyslogd was HUPed
localhost systemd[1]: logrotate.service: Main process exited, code=exited, status=1/FAILURE
localhost systemd[1]: logrotate.service: Failed with result 'exit-code'.
localhost systemd[1]: Failed to start Rotate log files.

I have ubuntu 20 as VM on google cloud. How fix this errors? Thanks.

upd: output for systemctl status logrotate.service

● logrotate.service - Rotate log files Loaded: loaded (/lib/systemd/system/logrotate.service; static; vendor preset: enabled) Active: inactive (dead)
TriggeredBy: ● logrotate.timer Docs: man:logrotate(8) man:logrotate.conf(5)
5

1 Answer

If you have your Litespeed logs in a location outside of /var/log, then the log rotation service will not have write access to the files that need to rotate. You have two options to choose from:

  1. Move your Litespeed logs to a directory in /var/log, such as /var/log/litespeed
  2. Update the logrotate.service file so the service can work with the log directory

Option 1 is pretty straightforward, so let's just look at the second item. This is how you can update the logrotate.service file:

  1. Open Terminal (if it's not already open)
  2. Open the logrotate.service file as root:
    sudo vi /lib/systemd/system/logrotate.service
    Note: Feel free to use a different editor if you prefer.
  3. Add the following line to the end of the file:
    ReadWritePaths=/usr/local/lsws/logs
  4. Save the file
  5. Restart the logrotate service:
    sudo systemctl daemon-reload && systemctl start logrotate
    Note: There is no output to this command.

Why?

In the logrotate.service file is a line that reads ProtectSystem=full. When ProtectSystem is set as full it will mount everything as readonly except the directory where logs are stored on the system, such as /var/log. By adding additional directories via ReadWritePaths you allow the service to use those locations without limitations.

If you're really interested in learning more about this, the documentation breaks everything down in detail ... though it is a rather dry read.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy