Skip to content

Commit 34f16ab

Browse files
committed
config: add new global 'storage.backlog.shutdown_flush' property (default: off)
Signed-off-by: Anuj Singh <[email protected]>
1 parent b0bd646 commit 34f16ab

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

include/fluent-bit/flb_config.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ struct flb_config {
244244
int storage_max_chunks_up; /* max number of chunks 'up' in memory */
245245
int storage_del_bad_chunks; /* delete irrecoverable chunks */
246246
char *storage_bl_mem_limit; /* storage backlog memory limit */
247+
int storage_bl_flush_on_shutdown; /* enable/disable backlog chunks flush on shutdown */
247248
struct flb_storage_metrics *storage_metrics_ctx; /* storage metrics context */
248249
int storage_trim_files; /* enable/disable file trimming */
249250

@@ -386,6 +387,8 @@ enum conf_type {
386387
#define FLB_CONF_STORAGE_METRICS "storage.metrics"
387388
#define FLB_CONF_STORAGE_CHECKSUM "storage.checksum"
388389
#define FLB_CONF_STORAGE_BL_MEM_LIMIT "storage.backlog.mem_limit"
390+
#define FLB_CONF_STORAGE_BL_FLUSH_ON_SHUTDOWN \
391+
"storage.backlog.flush_on_shutdown"
389392
#define FLB_CONF_STORAGE_MAX_CHUNKS_UP "storage.max_chunks_up"
390393
#define FLB_CONF_STORAGE_DELETE_IRRECOVERABLE_CHUNKS \
391394
"storage.delete_irrecoverable_chunks"

src/flb_config.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@ struct flb_service_config service_configs[] = {
145145
{FLB_CONF_STORAGE_BL_MEM_LIMIT,
146146
FLB_CONF_TYPE_STR,
147147
offsetof(struct flb_config, storage_bl_mem_limit)},
148+
{FLB_CONF_STORAGE_BL_FLUSH_ON_SHUTDOWN,
149+
FLB_CONF_TYPE_BOOL,
150+
offsetof(struct flb_config, storage_bl_flush_on_shutdown)},
148151
{FLB_CONF_STORAGE_MAX_CHUNKS_UP,
149152
FLB_CONF_TYPE_INT,
150153
offsetof(struct flb_config, storage_max_chunks_up)},
@@ -282,6 +285,7 @@ struct flb_config *flb_config_init()
282285
config->storage_path = NULL;
283286
config->storage_input_plugin = NULL;
284287
config->storage_metrics = FLB_TRUE;
288+
config->storage_bl_flush_on_shutdown = FLB_FALSE;
285289

286290
config->sched_cap = FLB_SCHED_CAP;
287291
config->sched_base = FLB_SCHED_BASE;

0 commit comments

Comments
 (0)