netsampler / goflow2

High performance sFlow/IPFIX/NetFlow Collector
BSD 3-Clause "New" or "Revised" License
463 stars 110 forks source link

add reload option for systemd service #340

Closed HaveSec closed 2 months ago

HaveSec commented 2 months ago

send HUP to goflow2 during service reload

marioschaefer commented 2 months ago

+1

lspgn commented 2 months ago

Hello, Thank you for your contribution. Can you add a bit more details on your use-case? Should be ok otherwise.

FYI: There is no hot-reload of the configuration, it's just for the logs rotation.

HaveSec commented 2 months ago

Hello,

I would like to use logrotate to manage the rotation of transport.files logs. To streamline this process, adding the reload option to the systemd service would be beneficial. Below are the steps to configure this:

File: /etc/logrotate.d/goflow2

/var/log/sflow/goflow2/goflow2.log
{
        rotate 60
        daily
        missingok
        notifempty
        compress
        delaycompress
        sharedscripts
        postrotate
                systemctl reload goflow2
        endscript
}

Thank you!