Subject: logrotation best practice

From: Faustin Lammler <[email-masked]>
Date: Mon, 8 Jan 2024 12:52:50 +0100

Hi!
First post here so, sorry if this is the wrong place.

I recently migrated from Debian to Alpine Linux for my daily driver and
I am so far absolutely happy with it, thank you all for this great OS!

My question is about logrotation on Alpine Linux (so, not in the context
of containers). I discovered that the zabbix agent2 package
(zabbix-agent2-6.4.10-r0) does not provide a logrotate configuration. Is
this normal? What's Alpine's approach with respect to log rotation?

I could not find any documentation so far.

Thanks and I wish you all the best for 2024!

-- 
Faustin
GPG: F652 BCD1 1AA8 8975 F010 48A5 390A 2F27 832A 5C79

---

From: Konstantin Kulikov <[email-masked]>
Date: Tue, 9 Jan 2024 18:24:16 +0300

Logging is still annoying.

Best case is when an application supports writing to a file with
O_APPEND and can reopen it on signal using open/dup2/close.
If it can't, openrc gives you 2 options
output_log - this redirects to a file and can only be rotated using a
racy copy/truncate approach (truncate option in logrotate).
output_logger - this redirects to stdin of another program, not
supported by supervise-daemon and your application will stall if
logger program crashes. This is the approach I use in my services.

% cat /etc/conf.d/victoria-metrics
...
error_logger="logger -t $RC_SVCNAME"
rc_need=logger