From 120dc52205be0a30cdb575c52ce923dc823930a4 Mon Sep 17 00:00:00 2001 From: Fujimoto Seiji Date: Mon, 14 Dec 2020 12:16:17 +0900 Subject: [PATCH] out_s3: do not use ':' in stream names on Windows (#2855) Windows does not allow directory names to contain a colon. For this reason, S3 plugin was unable to create the backlog directory. This patch fixes it by changing the directory name from /tmp/fluent-bit/s3/bucket/2020-12-01T12:31:21 into: /tmp/fluent-bit/s3/bucket/2020-12-01T12-31-21 Signed-off-by: Fujimoto Seiji --- cmake/windows-setup.cmake | 2 +- plugins/out_s3/s3_store.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cmake/windows-setup.cmake b/cmake/windows-setup.cmake index 8f6b71ba366..b3ba07afc17 100644 --- a/cmake/windows-setup.cmake +++ b/cmake/windows-setup.cmake @@ -67,7 +67,7 @@ set(FLB_OUT_FLOWCOUNTER Yes) set(FLB_OUT_KAFKA No) set(FLB_OUT_KAFKA_REST No) set(FLB_OUT_CLOUDWATCH_LOGS Yes) -set(FLB_OUT_S3 No) +set(FLB_OUT_S3 Yes) set(FLB_OUT_KINESIS_FIREHOSE No) # FILTER plugins diff --git a/plugins/out_s3/s3_store.c b/plugins/out_s3/s3_store.c index 85e1f9720cc..2de13aed755 100644 --- a/plugins/out_s3/s3_store.c +++ b/plugins/out_s3/s3_store.c @@ -261,7 +261,13 @@ int s3_store_init(struct flb_s3 *ctx) */ now = time(NULL); tm = localtime(&now); + +#ifdef FLB_SYSTEM_WINDOWS + /* Windows does not allow ':' in directory names */ + strftime(tmp, sizeof(tmp) - 1, "%Y-%m-%dT%H-%M-%S", tm); +#else strftime(tmp, sizeof(tmp) - 1, "%Y-%m-%dT%H:%M:%S", tm); +#endif /* Create the stream */ fs_stream = flb_fstore_stream_create(ctx->fs, tmp);