How to manually issue a logrotation for a service that has logrotate configured?
0
votes
1
answer
22
views
How do I trigger a manual logrotation for a service while using
logrotate
?
Basically, I want my current log-files for all my APPLICATION
to be empty, and the existing one should be moved to the 1
or .gz
; whatever may apply.
---
(While I could truncate the logfile manually via:
truncate -s 0 /var/log/APPLICATION/*.log
I don't want ignore the existing tool nor do I want to lose log data.)
---
More context:
An application on an Ubuntu Server (22.04.3) creates logfiles within
/var/log/APPLICATION/MY_LOG.log
I also see that there are .1
and .gz
-files:
/var/log/APPLICATION/SOME_LOG.log
/var/log/APPLICATION/SOME_LOG.log.1
/var/log/APPLICATION/SOME_LOG.log.2.gz
/var/log/APPLICATION/SOME_LOG.log.3.gz
...
I assume that logrotate
is used that creates new files after a certain criteria is met, as there is a config at:
/etc/logrotate.conf
which inlcudes:
/etc/logrotate.d/APPLICATION
which defines log configuration like so:
/var/log/APPLICATION/SOME_LOG.log
{
rotate 30
daily
missingok
notifempty
delaycompress
compress
postrotate
reload rsyslog >/dev/null 2>&1 || true
endscript
create 0644 syslog adm
}
Asked by k0pernikus
(16501 rep)
Apr 7, 2025, 12:49 PM
Last activity: Apr 7, 2025, 01:08 PM
Last activity: Apr 7, 2025, 01:08 PM