diff --git a/fluent-bit/patches/0002-file_out_time.patch b/fluent-bit/patches/0002-file_out_time.patch new file mode 100644 index 000000000..ee8524874 --- /dev/null +++ b/fluent-bit/patches/0002-file_out_time.patch @@ -0,0 +1,27 @@ +diff --git a/plugins/out_file/file.c b/plugins/out_file/file.c +index 77baf6be8..04c519d5a 100644 +--- a/plugins/out_file/file.c ++++ b/plugins/out_file/file.c +@@ -238,10 +238,20 @@ static int template_output_write(struct flb_file_conf *ctx, + + /* + * Right now we treat "{time}" specially and fill the placeholder +- * with the metadata timestamp (formatted as float). ++ * with the metadata timestamp. + */ + if (!strncmp(key, "time", size)) { +- fprintf(fp, "%f", flb_time_to_double(tm)); ++ struct tm tm_local; ++ char buf[32]; ++ if (localtime_r(&tm->tm.tv_sec, &tm_local) == NULL) { ++ flb_plg_error(ctx->ins, "localtime_r failed"); ++ return -1; ++ } ++ if (strftime(buf, sizeof(buf), "%b %d %H:%M:%S", &tm_local) == 0) { ++ flb_plg_error(ctx->ins, "strftime failed"); ++ return -1; ++ } ++ fputs(buf, fp); + return 0; + } +