mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
logmngr: reload fluent-bit on ntp sync event (via hotplug)
This commit is contained in:
parent
2d5570f6a0
commit
bdc435c392
2 changed files with 16 additions and 0 deletions
|
|
@ -65,8 +65,10 @@ define Package/logmngr/install
|
|||
$(INSTALL_DIR) $(1)/lib/logmngr
|
||||
ifeq ($(CONFIG_LOGMNGR_BACKEND_FLUENTBIT),y)
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/ntp/
|
||||
$(INSTALL_BIN) ./files/logread $(1)/sbin/
|
||||
$(INSTALL_DATA) ./files/lib/logmngr/fluent-bit.sh $(1)/lib/logmngr/
|
||||
$(INSTALL_BIN) ./files/etc/hotplug.d/ntp/45-reload_fluent_bit $(1)/etc/hotplug.d/ntp/
|
||||
else ifeq ($(CONFIG_LOGMNGR_BACKEND_SYSLOG_NG),y)
|
||||
$(INSTALL_DATA) ./files/lib/logmngr/syslog-ng.sh $(1)/lib/logmngr/
|
||||
endif
|
||||
|
|
|
|||
14
logmngr/files/etc/hotplug.d/ntp/20-reload_fluent_bit
Normal file
14
logmngr/files/etc/hotplug.d/ntp/20-reload_fluent_bit
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/sh
|
||||
# This hotplug script reloads fluent-bit, so that kmsg logs' timestamp gets in sync
|
||||
|
||||
[ "$ACTION" = stratum ] || exit 0
|
||||
|
||||
# only once
|
||||
if ! uci -q get time.global.first_use_date > /dev/null 2>&1; then
|
||||
flb_pid="$(pidof fluent-bit)"
|
||||
|
||||
if [ -n "$flb_pid" ]; then
|
||||
logger -t "logmngr.hotplug" -p info "reload fluent-bit due to ntp sync"
|
||||
kill -SIGHUP "$flb_pid"
|
||||
fi
|
||||
fi
|
||||
Loading…
Add table
Reference in a new issue