Logrotate timer does not work in OpsMan creating large log files
search cancel

Logrotate timer does not work in OpsMan creating large log files

book

Article ID: 293829

calendar_today

Updated On:

Products

Operations Manager

Issue/Introduction

OpsMan vm logs are being rotated with the use of logrotate timers and config. Sometimes this fails and the logs are not rotated, creating very large log files. For example syslog.log of 46Gb in size.

The Ops Manager VM is getting this logrotate Timer Unit configuration from the Jammy Stemcell.

To check the logrotate service status and timers use below commands:
systemctl list-timers --all
systemctl status logrotate.timer

To resolve this, you can try editing the logrotate Timer Unit file, reloading the systemd configuration, and then rebooting the Ops Manager VM.

To do that, become the root user and edit the /etc/systemd/system/logrotate.timer in the following way:

Replace the line that reads

OnUnitActiveSec=15min

with

OnCalendar=*-*-* *:00/15:00

Then run this to reload the systemd config

systemctl daemon-reload

and then reboot the Ops Manager VM.

Please note:

Log rotation for most log files on the OpsMan VM are configured using the delaycompress setting. The above workaround will re-enable the timers and begin the rotation again, but this setting means that log files are not compressed until the second time they are rotated. If immediate compression of these files is desired, please manually run the following command until logrotate successfully compresses the file:

logrotate -f /etc/logrotate.d/rsyslog


Environment

Product Version: 2.10

Resolution

Jammy stemcell 1.340 was released with the fix to logrotate. The OpsMan v3.0.23+ contains the fix.