diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index e29e9a21fc..b2b5f5035c 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -398,6 +398,8 @@ sudo cp -f $IMAGE_CONFIGS/logrotate/logrotate.d/* $FILESYSTEM_ROOT/etc/logrotate sudo cp $IMAGE_CONFIGS/logrotate/rsyslog.j2 $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/ sudo cp $IMAGE_CONFIGS/logrotate/logrotate-config.service $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM sudo cp $IMAGE_CONFIGS/logrotate/logrotate-config.sh $FILESYSTEM_ROOT/usr/bin/ +sudo mkdir -p $FILESYSTEM_ROOT/etc/systemd/system/logrotate.timer.d +sudo cp $IMAGE_CONFIGS/logrotate/timerOverride.conf $FILESYSTEM_ROOT/etc/systemd/system/logrotate.timer.d/ echo "logrotate-config.service" | sudo tee -a $GENERATED_SERVICE_FILE # Copy systemd-journald configuration files diff --git a/files/image_config/cron.d/logrotate b/files/image_config/cron.d/logrotate deleted file mode 100644 index 173a2abe2b..0000000000 --- a/files/image_config/cron.d/logrotate +++ /dev/null @@ -1,3 +0,0 @@ -# Attempt to rotate system logs once every 10 minutes. -# First kill any logrotate process(es) if they are still running, as they're most likely hung -*/10 * * * * root /usr/bin/pkill -9 logrotate > /dev/null 2>&1; /usr/sbin/logrotate /etc/logrotate.conf > /dev/null 2>&1 diff --git a/files/image_config/logrotate/timerOverride.conf b/files/image_config/logrotate/timerOverride.conf new file mode 100644 index 0000000000..fff55f5d72 --- /dev/null +++ b/files/image_config/logrotate/timerOverride.conf @@ -0,0 +1,2 @@ +[Timer] +OnCalendar=*:00/10:00