Skip to content

Commit cc6f17f

Browse files
committed
multiline: add json multiline builtin parser
Signed-off-by: lecaros <lecaros@chronosphere.io>
1 parent df2cc51 commit cc6f17f

5 files changed

Lines changed: 11 additions & 2 deletions

File tree

include/fluent-bit/multiline/flb_ml_parser.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,6 @@ struct flb_ml_parser *flb_ml_parser_java(struct flb_config *config, char *key);
8989
struct flb_ml_parser *flb_ml_parser_go(struct flb_config *config, char *key);
9090
struct flb_ml_parser *flb_ml_parser_ruby(struct flb_config *config, char *key);
9191
struct flb_ml_parser *flb_ml_parser_python(struct flb_config *config, char *key);
92+
struct flb_ml_parser *flb_ml_parser_json(struct flb_config *config, char *key);
9293

9394
#endif

plugins/filter_multiline/ml.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1023,7 +1023,7 @@ static struct flb_config_map config_map[] = {
10231023
{
10241024
FLB_CONFIG_MAP_CLIST, "multiline.parser", NULL,
10251025
FLB_CONFIG_MAP_MULT, FLB_TRUE, offsetof(struct ml_ctx, multiline_parsers),
1026-
"specify one or multiple multiline parsers: docker, cri, go, java, etc."
1026+
"specify one or multiple multiline parsers: docker, cri, go, java, json, etc."
10271027
},
10281028

10291029
{

plugins/in_tail/tail.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ static struct flb_config_map config_map[] = {
826826
{
827827
FLB_CONFIG_MAP_CLIST, "multiline.parser", NULL,
828828
FLB_CONFIG_MAP_MULT, FLB_TRUE, offsetof(struct flb_tail_config, multiline_parsers),
829-
"specify one or multiple multiline parsers: docker, cri, go, java, etc."
829+
"specify one or multiple multiline parsers: docker, cri, go, java, json, etc."
830830
},
831831
#endif
832832

src/multiline/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ set(src_multiline
66
multiline/flb_ml_parser_java.c
77
multiline/flb_ml_parser_go.c
88
multiline/flb_ml_parser_ruby.c
9+
multiline/flb_ml_parser_json.c
910
# core
1011
multiline/flb_ml_stream.c
1112
multiline/flb_ml_parser.c

src/multiline/flb_ml_parser.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,13 @@ int flb_ml_parser_builtin_create(struct flb_config *config)
188188
goto error;
189189
}
190190

191+
/* JSON */
192+
mlp = flb_ml_parser_json(config, NULL);
193+
if (!mlp) {
194+
flb_error("[multiline] could not init 'json' built-in parser");
195+
goto error;
196+
}
197+
191198
ret = 0;
192199
return ret;
193200

0 commit comments

Comments
 (0)