mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
logmngr: use fluent-bit filters to adapt kmsg fields and add hostname
This commit is contained in:
parent
d6e6747380
commit
a82c3562f2
2 changed files with 21 additions and 9 deletions
|
|
@ -5,7 +5,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=logmngr
|
||||
PKG_VERSION:=1.1.1
|
||||
PKG_VERSION:=1.1.2
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
|
|
|
|||
|
|
@ -69,10 +69,25 @@ create_service_section() {
|
|||
append_conf ""
|
||||
}
|
||||
|
||||
create_default_filters() {
|
||||
append_conf "[FILTER]"
|
||||
append_conf " name modify"
|
||||
append_conf " match KM*"
|
||||
append_conf " add ident kernel"
|
||||
append_conf " rename msg message"
|
||||
append_conf ""
|
||||
|
||||
append_conf "[FILTER]"
|
||||
append_conf " name sysinfo"
|
||||
append_conf " match *"
|
||||
append_conf " hostname_key hostname"
|
||||
append_conf ""
|
||||
}
|
||||
|
||||
create_input_section() {
|
||||
local tag="$1"
|
||||
|
||||
[ -z "$tag" ] && return
|
||||
[ -z "$tag" ] && return
|
||||
|
||||
# check if this source section has already been processed
|
||||
syslog_tag_already_processed "$tag" && return
|
||||
|
|
@ -90,7 +105,7 @@ create_input_section() {
|
|||
create_kmsg_input_section() {
|
||||
local tag="$1"
|
||||
|
||||
[ -z "$tag" ] && return
|
||||
[ -z "$tag" ] && return
|
||||
|
||||
# check if this source section has already been processed
|
||||
kmsg_tag_already_processed "$tag" && return
|
||||
|
|
@ -217,7 +232,7 @@ handle_filter_conf() {
|
|||
create_filter_section() {
|
||||
local match_regex="$1"
|
||||
|
||||
[ -z "$match_regex" ] && return
|
||||
[ -z "$match_regex" ] && return
|
||||
|
||||
append_conf "[FILTER]"
|
||||
append_conf " name grep"
|
||||
|
|
@ -297,11 +312,7 @@ handle_log_remote() {
|
|||
append_conf " syslog_appname_key ident"
|
||||
append_conf " syslog_procid_key pid"
|
||||
append_conf " syslog_message_key message"
|
||||
|
||||
local hostname="$(uci -q get 'system.@system[0].hostname')"
|
||||
if [ -n "${hostname}" ]; then
|
||||
append_conf " syslog_hostname_preset ${hostname}"
|
||||
fi
|
||||
append_conf " syslog_hostname_key hostname"
|
||||
|
||||
local proto # holds value tcp or udp
|
||||
config_get proto ${section} proto
|
||||
|
|
@ -453,6 +464,7 @@ logmngr_init() {
|
|||
|
||||
create_config_file
|
||||
create_service_section
|
||||
create_default_filters
|
||||
handle_action_section
|
||||
|
||||
if [ -f /lib/logmngr/logrotate.sh ]; then
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue