Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion plugins/out_file/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ struct flb_file_conf {
int format;
int csv_column_names;
int mkdir;
int line_append;
struct flb_output_instance *ins;
};

Expand Down Expand Up @@ -97,6 +98,7 @@ static int cb_file_init(struct flb_output_instance *ins,
ctx->delimiter = NULL;
ctx->label_delimiter = NULL;
ctx->template = NULL;
ctx->line_append = FLB_FALSE;

ret = flb_output_config_map_set(ins, (void *) ctx);
if (ret == -1) {
Expand Down Expand Up @@ -316,7 +318,9 @@ static int template_output(FILE *fp, struct flb_time *tm, msgpack_object *obj,
if (inbrace) {
fputs(inbrace, fp);
}
fputs(NEWLINE, fp);
if (ctx->line_append == FLB_FALSE){
fputs(NEWLINE, fp);
}
return 0;
}

Expand Down Expand Up @@ -636,6 +640,12 @@ static struct flb_config_map config_map[] = {
"Recursively create output directory if it does not exist. Permissions set to 0755"
},

{
FLB_CONFIG_MAP_BOOL, "line_append", "false",
0, FLB_TRUE, offsetof(struct flb_file_conf, line_append),
"Append new data to the end of log in same line. Default value is false"
},

/* EOF */
{0}
};
Expand Down