Skip to content

Commit 1b3ee6f

Browse files
authored
Merge branch 'master' into master
Signed-off-by: Tomasz Wilk <[email protected]>
2 parents f0a2e95 + 067c064 commit 1b3ee6f

File tree

91 files changed

+3640
-358
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+3640
-358
lines changed

.github/workflows/cron-scorecards-analysis.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
persist-credentials: false
3232

3333
- name: "Run analysis"
34-
uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186
34+
uses: ossf/scorecard-action@05b42c624433fc40578a4040d5cf5e36ddca8cde
3535
with:
3636
results_file: results.sarif
3737
results_format: sarif

.github/workflows/pr-compile-check.yaml

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333

3434
# Sanity check for compilation using system libraries
3535
pr-compile-system-libs:
36-
runs-on: ubuntu-22.04
36+
runs-on: ${{ matrix.os.version }}
3737
timeout-minutes: 60
3838
strategy:
3939
fail-fast: false
@@ -49,18 +49,26 @@ jobs:
4949
- clang:
5050
cc: clang
5151
cxx: clang++
52+
os:
53+
- version: ubuntu-22.04
54+
clang: "clang-12"
55+
- version: ubuntu-24.04
56+
clang: "clang-14"
57+
5258
steps:
53-
- name: Setup environment
59+
- name: Setup environment for ${{ matrix.os.version }} with ${{ matrix.os.clang }}
5460
run: |
5561
sudo apt-get update
56-
sudo apt-get install -y curl gcc-9 g++-9 clang-12 libsystemd-dev gcovr libyaml-dev
62+
sudo apt-get install -y curl gcc-9 g++-9 ${CLANG_PKG} libsystemd-dev gcovr libyaml-dev
5763
sudo ln -s /usr/bin/llvm-symbolizer-12 /usr/bin/llvm-symbolizer || true
64+
env:
65+
CLANG_PKG: ${{ matrix.os.clang }}
5866

5967
- name: Install system libraries for this test
6068
run: |
6169
sudo apt-get update
6270
sudo apt-get install -y libc-ares-dev libjemalloc-dev libluajit-5.1-dev \
63-
libnghttp2-dev libsqlite3-dev libzstd-dev
71+
libnghttp2-dev libsqlite3-dev libzstd-dev libmsgpack-dev
6472
mkdir -p /tmp/libbacktrace/build && \
6573
curl -L https://github.com/ianlancetaylor/libbacktrace/archive/8602fda.tar.gz | \
6674
tar --strip-components=1 -xzC /tmp/libbacktrace/ && \
@@ -80,7 +88,7 @@ jobs:
8088
echo "CC = $CC, CXX = $CXX, FLB_OPT = $FLB_OPT"
8189
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90
8290
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 90
83-
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-12 90
91+
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/${CLANG_PKG} 90
8492
cmake $GLOBAL_OPTS $FLB_OPT ../
8593
make -j $nparallel
8694
working-directory: build
@@ -89,6 +97,7 @@ jobs:
8997
CXX: ${{ matrix.compiler.cxx }}
9098
FLB_OPT: ${{ matrix.flb_option }}
9199
GLOBAL_OPTS: "-DFLB_JEMALLOC=On -DFLB_SHARED_LIB=Off -DFLB_DEBUG=On -DFLB_ALL=On -DFLB_EXAMPLES=Off"
100+
CLANG_PKG: ${{ matrix.os.clang }}
92101

93102
- name: Display dependencies w/ ldd
94103
run: |
@@ -102,3 +111,11 @@ jobs:
102111
echo "$ldd_result" | grep libsqlite3
103112
echo "$ldd_result" | grep libzstd
104113
working-directory: build
114+
115+
- name: Display dependencies w/ ldd for libmsgpack
116+
if: matrix.os.version == 'ubuntu-24.04'
117+
run: |
118+
export ldd_result=$(ldd ./bin/fluent-bit)
119+
echo "ldd result:"
120+
echo "$ldd_result" | grep libmsgpack
121+
working-directory: build

CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ set(CMAKE_POLICY_DEFAULT_CMP0069 NEW)
88
# Fluent Bit Version
99
set(FLB_VERSION_MAJOR 4)
1010
set(FLB_VERSION_MINOR 0)
11-
set(FLB_VERSION_PATCH 3)
11+
set(FLB_VERSION_PATCH 4)
1212
set(FLB_VERSION_STR "${FLB_VERSION_MAJOR}.${FLB_VERSION_MINOR}.${FLB_VERSION_PATCH}")
1313

1414
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
@@ -543,7 +543,11 @@ add_subdirectory(${FLB_PATH_LIB_FLUENT_OTEL} EXCLUDE_FROM_ALL)
543543
# MsgPack options
544544
if(FLB_PREFER_SYSTEM_LIB_MSGPACK)
545545
find_package(PkgConfig)
546+
# Try msgpack first (Ubuntu/Debian), then msgpack-c (Arch Linux)
546547
pkg_check_modules(MSGPACK msgpack>=4.0.0)
548+
if(NOT MSGPACK_FOUND)
549+
pkg_check_modules(MSGPACK msgpack-c>=4.0.0)
550+
endif()
547551
endif()
548552
if(MSGPACK_FOUND)
549553
include_directories(${MSGPACK_INCLUDE_DIRS})

dockerfiles/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# docker buildx build --platform "linux/amd64,linux/arm64,linux/arm/v7,linux/s390x" -f ./dockerfiles/Dockerfile.multiarch --build-arg FLB_TARBALL=https://github.com/fluent/fluent-bit/archive/v1.8.11.tar.gz ./dockerfiles/
1414

1515
# Set this to the current release version: it gets done so as part of the release.
16-
ARG RELEASE_VERSION=4.0.3
16+
ARG RELEASE_VERSION=4.0.4
1717

1818
# For multi-arch builds - assumption is running on an AMD64 host
1919
FROM multiarch/qemu-user-static:x86_64-arm AS qemu-arm32

fluent-bit-4.0.3.bb renamed to fluent-bit-4.0.4.bb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=2ee41112a44fe7014dce33e26468ba93"
1616
SECTION = "net"
1717

1818
PR = "r0"
19-
PV = "4.0.3"
19+
PV = "4.0.4"
2020

2121
SRCREV = "v${PV}"
2222
SRC_URI = "git://github.com/fluent/fluent-bit.git;nobranch=1"

include/fluent-bit/flb_api.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
#include <fluent-bit/flb_info.h>
2424
#include <fluent-bit/flb_output.h>
25+
#include <fluent-bit/flb_custom.h>
2526

2627
struct flb_api {
2728
const char *(*output_get_property) (const char *, struct flb_output_instance *);
@@ -33,6 +34,11 @@ struct flb_api {
3334
void (*log_print) (int, const char*, int, const char*, ...);
3435
int (*input_log_check) (struct flb_input_instance *, int);
3536
int (*output_log_check) (struct flb_output_instance *, int);
37+
38+
/* To preserve ABI, we need to add these APIs after the
39+
* input/output definitions. */
40+
const char *(*custom_get_property) (const char *, struct flb_custom_instance *);
41+
int (*custom_log_check) (struct flb_custom_instance *, int);
3642
};
3743

3844
#ifdef FLB_CORE

include/fluent-bit/flb_config.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,10 @@ struct flb_config {
6767
* shutdown when all remaining tasks are flushed
6868
*/
6969
int grace;
70-
int grace_count; /* Count of grace shutdown tries */
71-
flb_pipefd_t flush_fd; /* Timer FD associated to flush */
72-
int convert_nan_to_null; /* convert null to nan ? */
70+
int grace_count; /* Count of grace shutdown tries */
71+
int grace_input; /* Shutdown grace to keep inputs ingesting */
72+
flb_pipefd_t flush_fd; /* Timer FD associated to flush */
73+
int convert_nan_to_null; /* Convert null to nan ? */
7374

7475
int daemon; /* Run as a daemon ? */
7576
flb_pipefd_t shutdown_fd; /* Shutdown FD, 5 seconds */
@@ -243,8 +244,11 @@ struct flb_config {
243244
int storage_max_chunks_up; /* max number of chunks 'up' in memory */
244245
int storage_del_bad_chunks; /* delete irrecoverable chunks */
245246
char *storage_bl_mem_limit; /* storage backlog memory limit */
247+
int storage_bl_flush_on_shutdown; /* enable/disable backlog chunks flush on shutdown */
246248
struct flb_storage_metrics *storage_metrics_ctx; /* storage metrics context */
247249
int storage_trim_files; /* enable/disable file trimming */
250+
char *storage_type; /* global storage type */
251+
int storage_inherit; /* apply storage type to inputs */
248252

249253
/* Embedded SQL Database support (SQLite3) */
250254
#ifdef FLB_HAVE_SQLDB
@@ -392,10 +396,14 @@ enum conf_type {
392396
#define FLB_CONF_STORAGE_METRICS "storage.metrics"
393397
#define FLB_CONF_STORAGE_CHECKSUM "storage.checksum"
394398
#define FLB_CONF_STORAGE_BL_MEM_LIMIT "storage.backlog.mem_limit"
399+
#define FLB_CONF_STORAGE_BL_FLUSH_ON_SHUTDOWN \
400+
"storage.backlog.flush_on_shutdown"
395401
#define FLB_CONF_STORAGE_MAX_CHUNKS_UP "storage.max_chunks_up"
396402
#define FLB_CONF_STORAGE_DELETE_IRRECOVERABLE_CHUNKS \
397403
"storage.delete_irrecoverable_chunks"
398404
#define FLB_CONF_STORAGE_TRIM_FILES "storage.trim_files"
405+
#define FLB_CONF_STORAGE_TYPE "storage.type"
406+
#define FLB_CONF_STORAGE_INHERIT "storage.inherit"
399407

400408
/* Coroutines */
401409
#define FLB_CONF_STR_CORO_STACK_SIZE "Coro_Stack_Size"

include/fluent-bit/flb_custom.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,20 @@
3131
#define FLB_CUSTOM_NET_CLIENT 1 /* custom may use upstream net.* properties */
3232
#define FLB_CUSTOM_NET_SERVER 2 /* custom may use downstream net.* properties */
3333

34+
/* Custom plugin types */
35+
#define FLB_CUSTOM_PLUGIN_CORE 0
36+
#define FLB_CUSTOM_PLUGIN_PROXY 1
37+
3438
struct flb_custom_instance;
3539

3640
struct flb_custom_plugin {
41+
/*
42+
* The type defines if this is a core-based plugin or it's handled by
43+
* some specific proxy.
44+
*/
45+
int type;
46+
void *proxy;
47+
3748
int flags; /* Flags (not available at the moment */
3849
char *name; /* Custom plugin short name */
3950
char *description; /* Description */
@@ -49,6 +60,9 @@ struct flb_custom_plugin {
4960
void *, struct flb_config *);
5061
int (*cb_exit) (void *, struct flb_config *);
5162

63+
/* Destroy */
64+
void (*cb_destroy) (struct flb_custom_plugin *);
65+
5266
struct mk_list _head; /* Link to parent list (config->custom) */
5367
};
5468

@@ -96,5 +110,6 @@ int flb_custom_plugin_property_check(struct flb_custom_instance *ins,
96110
int flb_custom_init_all(struct flb_config *config);
97111
void flb_custom_set_context(struct flb_custom_instance *ins, void *context);
98112
void flb_custom_instance_destroy(struct flb_custom_instance *ins);
113+
int flb_custom_log_check(struct flb_custom_instance *ins, int l);
99114

100115
#endif

include/fluent-bit/flb_engine.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ int flb_engine_exit_status(struct flb_config *config, int status);
3737
int flb_engine_shutdown(struct flb_config *config);
3838
int flb_engine_destroy_tasks(struct mk_list *tasks);
3939
void flb_engine_reschedule_retries(struct flb_config *config);
40+
void flb_engine_stop_ingestion(struct flb_config *config);
4041

4142
/* Engine event loop */
4243
void flb_engine_evl_init();

include/fluent-bit/flb_log.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
#include <fluent-bit/flb_worker.h>
2929
#include <fluent-bit/flb_config.h>
3030
#include <fluent-bit/flb_sds.h>
31+
#include <cmetrics/cmetrics.h>
32+
#include <cmetrics/cmt_counter.h>
3133
#include <inttypes.h>
3234
#include <errno.h>
3335
#include <stdarg.h>
@@ -72,6 +74,7 @@ struct flb_log {
7274
pthread_t tid; /* thread ID */
7375
struct flb_worker *worker; /* non-real worker reference */
7476
struct mk_event_loop *evl;
77+
struct flb_log_metrics *metrics;
7578

7679
/* Initialization variables */
7780
int pth_init;
@@ -92,6 +95,14 @@ struct flb_log_cache {
9295
struct mk_list entries; /* list for entries */
9396
};
9497

98+
/* Global metrics for logging calls. */
99+
struct flb_log_metrics {
100+
struct cmt *cmt;
101+
102+
/* cmetrics */
103+
struct cmt_counter *logs_total_counter; /* total number of logs (by message type) */
104+
};
105+
95106
/*
96107
* This function is used by plugins interface to check if an incoming log message
97108
* should be logged or not based in the log levels defined.

0 commit comments

Comments
 (0)