fluent-bit: align with upstream openwrt fluent-bit package

This commit is contained in:
Mohd Husaam Mehdi 2025-12-30 16:25:35 +05:30 committed by Vivek Dutta
parent 81fd3d01ff
commit a5ca7344e9
2 changed files with 55 additions and 67 deletions

View file

@ -1,21 +1,13 @@
#
# Copyright (C) 2024-2025 IOPSYS
#
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=fluent-bit PKG_NAME:=fluent-bit
PKG_VERSION:=4.0.4 PKG_VERSION:=4.2.0
PKG_RELEASE:=$(AUTORELEASE) PKG_RELEASE:=1
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/fluent/fluent-bit.git PKG_SOURCE_URL:=https://github.com/fluent/fluent-bit.git
PKG_SOURCE_VERSION=v$(PKG_VERSION) PKG_SOURCE_VERSION=v$(PKG_VERSION)
PKG_SOURCE:=$(PKG_NAME)-v$(PKG_VERSION).tar.zst PKG_MIRROR_HASH:=cad2d94cf7a720a3910c781f80187e2c399aa8acbfa1046aa7445a4d1495fafd
PKG_MIRROR_HASH:=skip
endif
PKG_LICENSE:=Apache-2.0 PKG_LICENSE:=Apache-2.0
PKG_LICENSE_FILES:=LICENSE PKG_LICENSE_FILES:=LICENSE
@ -24,52 +16,55 @@ include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk include $(INCLUDE_DIR)/cmake.mk
define Package/fluent-bit define Package/fluent-bit
CATEGORY:=Utilities SECTION:=admin
DEPENDS:= +libyaml +libopenssl +libcurl +libatomic +musl-fts +flex +bison +libstdcpp +@OPENSSL_WITH_NPN CATEGORY:=Administration
TITLE:=Fluent-Bit TITLE:=Fast and Lightweight Logs and Metrics processor
URL:=https://fluentbit.io/ URL:=https://fluentbit.io/
DEPENDS:= +libyaml +libopenssl +libcurl +libstdcpp +libatomic +musl-fts +flex +bison \
+libsasl2 +@OPENSSL_WITH_NPN
endef endef
define Package/fluent-bit/description define Package/fluent-bit/description
Fluent Bit is a super fast, lightweight, and highly scalable logging and metrics processor and forwarder. Fluent Bit is a super fast, lightweight, and highly scalable logging
and metrics processor and forwarder.
endef endef
ifeq ($(LOCAL_DEV),1) define Package/fluent-bit/conffiles
define Build/Prepare /etc/fluent-bit/parsers.conf
$(CP) -rf ./fluent-bit/* $(PKG_BUILD_DIR)/
endef endef
endif
# General options
TARGET_LDFLAGS +=-lfts -latomic TARGET_LDFLAGS +=-lfts -latomic
CMAKE_OPTIONS+= \ CMAKE_OPTIONS+= \
-DFLB_RELEASE=Yes \ -DFLB_RELEASE=Yes \
-DFLB_SMALL=No \
-DEXCLUDE_FROM_ALL=true \ -DEXCLUDE_FROM_ALL=true \
-DFLB_SHARED_LIB=Yes \
-DFLB_DEBUG=Yes \
-DFLB_ALL=No \
-DFLB_JEMALLOC=No \
-DFLB_EXAMPLES=No \ -DFLB_EXAMPLES=No \
-DFLB_CHUNK_TRACE=No \ -DFLB_CHUNK_TRACE=No \
-DFLB_BACKTRACE=No \ -DFLB_BACKTRACE=No \
-DFLB_KAFKA=No \
-DFLB_WASM=No \ -DFLB_WASM=No \
-DFLB_LUAJIT=Yes -DFLB_LUAJIT=Yes \
-DWITH_SASL=No \
-DWITH_ZLIB=No \
-DWITH_ZSTD=No
CMAKE_OPTIONS += \
-DFLB_SMALL=Yes \
-DFLB_ALL=No \
-DFLB_DEBUG=Yes \
-DFLB_JEMALLOC=No \
-DFLB_KAFKA=No
# In plugins
CMAKE_OPTIONS += \ CMAKE_OPTIONS += \
-DFLB_IN_SYSLOG=Yes \ -DFLB_IN_SYSLOG=Yes \
-DFLB_IN_CPU=Yes \ -DFLB_IN_CPU=Yes \
-DFLB_IN_MEM=Yes \ -DFLB_IN_MEM=Yes \
-DFLB_IN_DISK=Yes \ -DFLB_IN_DISK=Yes \
-DFLB_IN_EXEC=Yes \
-DFLB_IN_HEAD=Yes \ -DFLB_IN_HEAD=Yes \
-DFLB_IN_KMSG=Yes \ -DFLB_IN_KMSG=Yes \
-DFLB_IN_TAIL=Yes \ -DFLB_IN_TAIL=Yes \
-DFLB_IN_FORWARD=No \
-DFLB_IN_PROC=No \ -DFLB_IN_PROC=No \
-DFLB_IN_EXEC=No \
-DFLB_IN_FORWARD=No \
-DFLB_IN_RANDOM=No \ -DFLB_IN_RANDOM=No \
-DFLB_IN_SERIAL=No \ -DFLB_IN_SERIAL=No \
-DFLB_IN_MQTT=No \ -DFLB_IN_MQTT=No \
@ -85,7 +80,6 @@ CMAKE_OPTIONS += \
-DFLB_IN_KUBERNETES_EVENTS=No \ -DFLB_IN_KUBERNETES_EVENTS=No \
-DFLB_IN_KAFKA=No \ -DFLB_IN_KAFKA=No \
-DFLB_IN_LIB=No \ -DFLB_IN_LIB=No \
-DFLB_IN_SYSTEMD=No \
-DFLB_IN_DUMMY=No \ -DFLB_IN_DUMMY=No \
-DFLB_IN_NETIF=No \ -DFLB_IN_NETIF=No \
-DFLB_IN_COLLECTD=No \ -DFLB_IN_COLLECTD=No \
@ -96,18 +90,18 @@ CMAKE_OPTIONS += \
-DFLB_IN_OPENTELEMETRY=No \ -DFLB_IN_OPENTELEMETRY=No \
-DFLB_IN_ELASTICSEARCH=No \ -DFLB_IN_ELASTICSEARCH=No \
-DFLB_IN_CALYPTIA_FLEET=No \ -DFLB_IN_CALYPTIA_FLEET=No \
-DFLB_IN_SPLUNK=No -DFLB_IN_SPLUNK=No \
-DFLB_IN_HEALTH=No \ -DFLB_IN_HEALTH=No \
-DFLB_IN_WINLOG=No \ -DFLB_IN_WINLOG=No \
-DFLB_IN_WINEVTLOG=No -DFLB_IN_WINEVTLOG=No
# Filter options
CMAKE_OPTIONS += \ CMAKE_OPTIONS += \
-DFLB_FILTER_LUA=Yes \
-DFLB_FILTER_SYSINFO=Yes \
-DFLB_FILTER_MODIFY=Yes \
-DFLB_FILTER_AWS=No \ -DFLB_FILTER_AWS=No \
-DFLB_FILTER_ECS=No \ -DFLB_FILTER_ECS=No \
-DFLB_FILTER_KUBERNETES=No \ -DFLB_FILTER_KUBERNETES=No \
-DFLB_FILTER_LUA=Yes \
-DFLB_FILTER_NEST=No \ -DFLB_FILTER_NEST=No \
-DFLB_FILTER_RECORD_MODIFIER=No \ -DFLB_FILTER_RECORD_MODIFIER=No \
-DFLB_FILTER_THROTTLE=No \ -DFLB_FILTER_THROTTLE=No \
@ -117,10 +111,8 @@ CMAKE_OPTIONS += \
-DFLB_FILTER_GEOIP2=No \ -DFLB_FILTER_GEOIP2=No \
-DFLB_FILTER_NIGHTFALL=No -DFLB_FILTER_NIGHTFALL=No
# out plugins
CMAKE_OPTIONS += \ CMAKE_OPTIONS += \
-DFLB_OUT_EXIT=Yes \ -DFLB_OUT_EXIT=Yes \
-DFLB_OUT_FORWARD=Yes \
-DFLB_OUT_HTTP=Yes \ -DFLB_OUT_HTTP=Yes \
-DFLB_OUT_NATS=Yes \ -DFLB_OUT_NATS=Yes \
-DFLB_OUT_TCP=Yes \ -DFLB_OUT_TCP=Yes \
@ -129,6 +121,7 @@ CMAKE_OPTIONS += \
-DFLB_OUT_STDOUT=Yes \ -DFLB_OUT_STDOUT=Yes \
-DFLB_OUT_SYSLOG=Yes \ -DFLB_OUT_SYSLOG=Yes \
-DFLB_OUT_NULL=Yes \ -DFLB_OUT_NULL=Yes \
-DFLB_OUT_FORWARD=No \
-DFLB_OUT_PLOT=No \ -DFLB_OUT_PLOT=No \
-DFLB_OUT_AZURE=No \ -DFLB_OUT_AZURE=No \
-DFLB_OUT_AZURE_BLOB=No \ -DFLB_OUT_AZURE_BLOB=No \
@ -142,6 +135,7 @@ CMAKE_OPTIONS += \
-DFLB_OUT_GELF=No \ -DFLB_OUT_GELF=No \
-DFLB_OUT_INFLUXDB=No \ -DFLB_OUT_INFLUXDB=No \
-DFLB_OUT_KAFKA=No \ -DFLB_OUT_KAFKA=No \
-DFLB_OUT_KAFKA_REST=No \
-DFLB_OUT_NRLOGS=No \ -DFLB_OUT_NRLOGS=No \
-DFLB_OUT_OPENSEARCH=No \ -DFLB_OUT_OPENSEARCH=No \
-DFLB_OUT_TD=No \ -DFLB_OUT_TD=No \
@ -153,8 +147,6 @@ CMAKE_OPTIONS += \
-DFLB_OUT_FLOWCOUNTER=No \ -DFLB_OUT_FLOWCOUNTER=No \
-DFLB_OUT_LOGDNA=No \ -DFLB_OUT_LOGDNA=No \
-DFLB_OUT_LOKI=No \ -DFLB_OUT_LOKI=No \
-DFLB_OUT_KAFKA=No \
-DFLB_OUT_KAFKA_REST=No \
-DFLB_OUT_CLOUDWATCH_LOGS=No \ -DFLB_OUT_CLOUDWATCH_LOGS=No \
-DFLB_OUT_KINESIS_FIREHOSE=No \ -DFLB_OUT_KINESIS_FIREHOSE=No \
-DFLB_OUT_KINESIS_STREAMS=No \ -DFLB_OUT_KINESIS_STREAMS=No \
@ -170,11 +162,10 @@ CMAKE_OPTIONS += \
define Package/fluent-bit/install define Package/fluent-bit/install
$(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_DIR) $(1)/etc/fluent-bit
$(INSTALL_DIR) $(1)/etc/fluent-bit/conf.d
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/fluent-bit $(1)/usr/sbin/ $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/fluent-bit $(1)/usr/sbin/
$(INSTALL_DATA) ./files/fluent-bit.conf $(1)/etc/fluent-bit/fluent-bit.conf
$(INSTALL_DATA) $(PKG_BUILD_DIR)/conf/parsers.conf $(1)/etc/fluent-bit/parsers.conf $(INSTALL_DIR) $(1)/etc/fluent-bit
$(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/parsers.conf $(1)/etc/fluent-bit/parsers.conf
endef endef
$(eval $(call BuildPackage,fluent-bit)) $(eval $(call BuildPackage,fluent-bit))

View file

@ -1,5 +1,5 @@
diff --git a/plugins/in_kmsg/in_kmsg.c b/plugins/in_kmsg/in_kmsg.c diff --git a/plugins/in_kmsg/in_kmsg.c b/plugins/in_kmsg/in_kmsg.c
index cd5c4cd17..15f105451 100644 index fe372a9a2..6acb34893 100644
--- a/plugins/in_kmsg/in_kmsg.c --- a/plugins/in_kmsg/in_kmsg.c
+++ b/plugins/in_kmsg/in_kmsg.c +++ b/plugins/in_kmsg/in_kmsg.c
@@ -36,7 +36,6 @@ @@ -36,7 +36,6 @@
@ -10,15 +10,24 @@ index cd5c4cd17..15f105451 100644
#include "in_kmsg.h" #include "in_kmsg.h"
@@ -123,12 +122,17 @@ static inline int process_line(const char *line, @@ -114,7 +113,7 @@ static inline int process_line(const char *line,
struct timeval tv; /* time value */
int line_len;
uint64_t val;
- long pri_val;
+ unsigned long pri_val;
const char *p = line;
char *end = NULL;
struct flb_time ts;
@@ -124,12 +123,17 @@ static inline int process_line(const char *line,
ctx->buffer_id++; ctx->buffer_id++;
errno = 0; errno = 0;
- val = strtol(p, &end, 10); - pri_val = strtol(p, &end, 10);
- if ((errno == ERANGE && (val == INT_MAX || val == INT_MIN)) - if ((errno == ERANGE && (pri_val == INT_MAX || pri_val == INT_MIN))
+ val = strtoul(p, &end, 10); + pri_val = strtoul(p, &end, 10);
+ if ((errno == ERANGE && val == ULONG_MAX) + if ((errno == ERANGE && pri_val == ULONG_MAX)
|| (errno != 0 && val == 0)) { || (errno != 0 && pri_val == 0)) {
goto fail; goto fail;
} }
@ -28,17 +37,9 @@ index cd5c4cd17..15f105451 100644
+ } + }
+ +
/* Priority */ /* Priority */
priority = FLB_KLOG_PRI(val); priority = FLB_KLOG_PRI(pri_val);
@@ -144,24 +148,35 @@ static inline int process_line(const char *line, @@ -152,6 +156,12 @@ static inline int process_line(const char *line,
}
p++;
- val = strtoul(p, &end, 10);
- if ((errno == ERANGE && (val == INT_MAX || val == INT_MIN))
+ val = strtoull(p, &end, 10);
+ if ((errno == ERANGE && val == ULLONG_MAX)
|| (errno != 0 && val == 0)) {
goto fail; goto fail;
} }
@ -51,12 +52,7 @@ index cd5c4cd17..15f105451 100644
sequence = val; sequence = val;
p = ++end; p = ++end;
/* Timestamp */ @@ -162,8 +172,14 @@ static inline int process_line(const char *line,
- val = strtoul(p, &end, 10);
- if ((errno == ERANGE && (val == INT_MAX || val == INT_MIN))
+ val = strtoull(p, &end, 10);
+ if ((errno == ERANGE && val == ULLONG_MAX)
|| (errno != 0 && val == 0)) {
goto fail; goto fail;
} }
@ -68,6 +64,7 @@ index cd5c4cd17..15f105451 100644
tv.tv_sec = val/1000000; tv.tv_sec = val/1000000;
- tv.tv_usec = val - (tv.tv_sec * 1000000); - tv.tv_usec = val - (tv.tv_sec * 1000000);
+ tv.tv_usec = val - ((uint64_t)tv.tv_sec * 1000000); + tv.tv_usec = val - ((uint64_t)tv.tv_sec * 1000000);
+
flb_time_set(&ts, ctx->boot_time.tv_sec + tv.tv_sec, tv.tv_usec * 1000); flb_time_set(&ts, ctx->boot_time.tv_sec + tv.tv_sec, tv.tv_usec * 1000);