mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
fluent-bit: convert kmsg pri field from char to string
In order to support filtering based on serverity and facility in logmngr config, we need to be able to configure regex on the priority field, but kmsg input plugin sends the priority field as char, on which regex does not work. We also cannot use the type converter filter which is present in fluent bit, because it does not support the source data type to be char. Therefore, we change priority from a char to a string field.
This commit is contained in:
parent
43a0dfc863
commit
fea302bd43
1 changed files with 20 additions and 0 deletions
20
fluent-bit/patches/0030-kmsg_pri_as_string.patch
Normal file
20
fluent-bit/patches/0030-kmsg_pri_as_string.patch
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
diff --git a/plugins/in_kmsg/in_kmsg.c b/plugins/in_kmsg/in_kmsg.c
|
||||
index cd5c4cd17..04bbe2b2e 100644
|
||||
--- a/plugins/in_kmsg/in_kmsg.c
|
||||
+++ b/plugins/in_kmsg/in_kmsg.c
|
||||
@@ -182,11 +182,14 @@ static inline int process_line(const char *line,
|
||||
&ts);
|
||||
}
|
||||
|
||||
+ char priority_str[4] = {0}; /* enough for "255" + NUL */
|
||||
+ snprintf(priority_str, sizeof(priority_str), "%u", (unsigned char) priority);
|
||||
+
|
||||
if (ret == FLB_EVENT_ENCODER_SUCCESS) {
|
||||
ret = flb_log_event_encoder_append_body_values(
|
||||
&ctx->log_encoder,
|
||||
FLB_LOG_EVENT_CSTRING_VALUE("priority"),
|
||||
- FLB_LOG_EVENT_CHAR_VALUE(priority),
|
||||
+ FLB_LOG_EVENT_STRING_VALUE(priority_str, strlen(priority_str)),
|
||||
|
||||
FLB_LOG_EVENT_CSTRING_VALUE("sequence"),
|
||||
FLB_LOG_EVENT_UINT64_VALUE(sequence),
|
||||
Loading…
Add table
Reference in a new issue