Skip to content

Commit 25b722d

Browse files
committed
out_http: support 'false' value to disable json_date_key (#2352)
Signed-off-by: Eduardo Silva <[email protected]>
1 parent c10ac2f commit 25b722d

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

plugins/out_http/http.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ static void cb_http_flush(const void *data, size_t bytes,
306306
json = flb_pack_msgpack_to_json_format(data, bytes,
307307
ctx->out_format,
308308
ctx->json_date_format,
309-
ctx->json_date_key);
309+
ctx->date_key);
310310
if (json != NULL) {
311311
ret = http_post(ctx, json, flb_sds_len(json), tag, tag_len);
312312
flb_sds_destroy(json);

plugins/out_http/http.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ struct flb_out_http {
4343

4444
int json_date_format;
4545
flb_sds_t json_date_key;
46+
flb_sds_t date_key; /* internal use */
4647

4748
/* HTTP URI */
4849
char *uri;

plugins/out_http/http_conf.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,16 @@ struct flb_out_http *flb_http_conf_create(struct flb_output_instance *ins,
160160
}
161161
}
162162

163+
/* Date key */
164+
ctx->date_key = ctx->json_date_key;
165+
tmp = flb_output_get_property("json_date_key", ins);
166+
if (tmp) {
167+
/* Just check if we have to disable it */
168+
if (flb_utils_bool(tmp) == FLB_FALSE) {
169+
ctx->date_key = NULL;
170+
}
171+
}
172+
163173
/* Date format for JSON output */
164174
ctx->json_date_format = FLB_PACK_JSON_DATE_DOUBLE;
165175
tmp = flb_output_get_property("json_date_format", ins);

0 commit comments

Comments
 (0)