Skip to content

Commit

Permalink
out_s3: do not use ':' in stream names on Windows (#2855)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
fujimotos authored Dec 14, 2020
1 parent 3ec1528 commit 120dc52
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmake/windows-setup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions plugins/out_s3/s3_store.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 120dc52

Please sign in to comment.