emmacz
07/31/2025, 7:11 PMCentOS Linux 8 we have configured for fluent-bit 4.0.2 ..
Currently we have this setting -- see below, which has many default values set (see manpage for systemd), especially:
DefaultTimeoutStopSec=90
This directive/property causes that command systemctl stop mon-logagent ... will start to stop fluent-bit and if it will not be finished during 90s then SIGKILL signal is sent.
Our requirement is to reduce the stopping time to minimum ... let's say 15s. Ideally try the sequence of signals like is described below:
https://github.com/systemd/systemd/issues/13284
SIGSTOP -- wait few sec. -- SIGTERM -- wait few sec. -- SIGKILL
------------ Is there some recommended way to do it? ------------------
Here is our service's config file:
# /etc/systemd/system/mon-logagent.service
[Unit]
Description=mon logagent
After=local-fs.target network-online.target network.target rsyslog.service sshd.service
[Service]
Type=simple
LimitNOFILE=65536
ExecStartPre=/var/lib/mon/scripts/mon-logagent-pre.sh
ExecStartPost=/var/lib/mon/scripts/mon-logagent-post-start.sh
EnvironmentFile=-/etc/sysconfig/mon-fa-logagent
ExecStart=/usr/local/bin/mon/fluent-bit -c /usr/local/etc/mon-fluent-bit/fluent-bit.yaml
RestartSec=60
Restart=always
MemoryMax=6G
MemoryLimit=6G
MemorySwapMax=4G
ExecReload=/bin/kill -s SIGHUP $MAINPID
[Install]
WantedBy=multi-user.targetPat
08/01/2025, 10:12 AMemmacz
08/01/2025, 10:28 AMKillModeemmacz
08/01/2025, 10:33 AMIf your app's shutdown logic is well written .. KillMode=mixed can be much cleaner and faster than mass-signaling (KillMode=control-group)
So is your 🙂 code designed for KillMode=mixed or for any other Kill mode is better recommend?
Of course we want to have guarantee that there will be no files corruption (FB database offset/position files) and minimal records loss.emmacz
08/01/2025, 10:39 AM15s
So far it looks like that I I send whatever signal to main fluent-bit process 1st (KillMode=mixed), this will handle stopping all childs, threads,.. a bit faster (maybe 20%) then if I let it do by cgroup (KillMode=control-group))emmacz
08/01/2025, 10:44 AM