Skip to content

logrotate service is not running every hour #5117

@ravening

Description

@ravening
ISSUE TYPE
  • Bug Report
COMPONENT NAME
logrotate / systemvm image
CLOUDSTACK VERSION
4.16
CONFIGURATION
OS / ENVIRONMENT
SUMMARY

Logrotate service should run every hour and rotate the files if they exceed the file size according to the config.
For the file /varlog/daemon.log, we have the following config in /etc/logrotate.d/rsyslog

{
        rotate 10
        maxsize 10M
        missingok
        notifempty
        compress
        sharedscripts
        postrotate
                /usr/lib/rsyslog/rsyslog-rotate
        endscript
}

which means it should rotate this file when the size exceeds 10M. In one of the router the file size was greater than 1GB but still, it was not rotated. The logrotate was supposed to run every hour according to cron since the file is present in /etc/cron.hourly/logrotate

I added some logs in this file and ran it manually but it exits before rotating the file

# cat /etc/cron.hourly/logrotate
#!/bin/sh

# skip in favour of systemd timer
if [ -d /run/systemd/system ]; then
    /usr/bin/logger -t logrotate "logrotate: I am exiting in systemd folder"
    exit 0
fi

So its not proceeding further and doing its job.

@weizhouapache @ustcweizhou do you have any idea on this since you have fixed some issue in 4.15?

STEPS TO REPRODUCE
Add some dummy content to /var/log/daemon.log and increase its size to greater than 10Mb.
After 1 hour the logrotate should rotate this file
EXPECTED RESULTS
The /var/log/daemon.log file should get rotated and the size should reduce
ACTUAL RESULTS
The file is not rotating and because of that router vm disk get full and all services inside it crashes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions