Fix #158: Add copytruncate to logrotate.conf.

From lograte man pages:

> `copytruncate`: Truncate the original log file to zero size in place after creating a copy, instead of moving the old log file and optionally creating a new one.

Why? Because file might be followed by file descriptior (and not name).
So when logrorate rotates the file, Prometheus will follow the old file
(thus receiving no metrics).

By using `comytruncate` we ensure that the followed file is always the
proper one.
This commit is contained in:
Bojan Čekrlić 2023-12-29 14:39:21 +01:00
parent 4b4524940e
commit 72988ddf47

View file

@ -52,6 +52,7 @@ metrics:
enabled: true
logrotate.conf: |
/var/log/mail.log {
copytruncate
rotate 1
monthly
minsize 1M