|
32 | 32 | #include <fluent-bit/flb_env.h> |
33 | 33 | #include <fluent-bit/flb_str.h> |
34 | 34 | #include <fluent-bit/multiline/flb_ml.h> |
| 35 | +#include <fluent-bit/multiline/flb_ml_parser.h> |
35 | 36 |
|
36 | 37 | #include <sys/types.h> |
37 | 38 | #include <sys/stat.h> |
@@ -352,10 +353,14 @@ void flb_parser_exit(struct flb_config *config) |
352 | 353 | struct mk_list *head; |
353 | 354 | struct flb_parser *parser; |
354 | 355 |
|
| 356 | + /* release 'parsers' */ |
355 | 357 | mk_list_foreach_safe(head, tmp, &config->parsers) { |
356 | 358 | parser = mk_list_entry(head, struct flb_parser, _head); |
357 | 359 | flb_parser_destroy(parser); |
358 | 360 | } |
| 361 | + |
| 362 | + /* release 'multiline parsers' */ |
| 363 | + flb_ml_exit(config); |
359 | 364 | } |
360 | 365 |
|
361 | 366 | static int proc_types_str(const char *types_str, struct flb_parser_types **types) |
@@ -606,7 +611,7 @@ static int multiline_parser_conf_file(const char *cfg, struct mk_rconf *fconf, |
606 | 611 | int flush_timeout; |
607 | 612 | struct mk_list *head; |
608 | 613 | struct mk_rconf_section *section; |
609 | | - struct flb_ml *ml; |
| 614 | + struct flb_ml_parser *ml_parser; |
610 | 615 |
|
611 | 616 | /* Read all [PARSER] sections */ |
612 | 617 | mk_list_foreach(head, &fconf->sections) { |
@@ -676,9 +681,13 @@ static int multiline_parser_conf_file(const char *cfg, struct mk_rconf *fconf, |
676 | 681 | flush_timeout = atoi(tmp); |
677 | 682 | } |
678 | 683 |
|
679 | | - ml = flb_ml_create(config, name, type, match_string, negate, |
680 | | - flush_timeout, key_content, key_group, key_pattern, |
681 | | - NULL, parser); |
| 684 | + ml_parser = flb_ml_parser_create(config, name, type, match_string, |
| 685 | + negate, flush_timeout, key_content, |
| 686 | + key_group, key_pattern, |
| 687 | + NULL, parser); |
| 688 | + if (!ml_parser) { |
| 689 | + goto fconf_error; |
| 690 | + } |
682 | 691 |
|
683 | 692 | flb_sds_destroy(name); |
684 | 693 | flb_sds_destroy(match_string); |
@@ -742,6 +751,7 @@ int flb_parser_conf_file(const char *file, struct flb_config *config) |
742 | 751 | return -1; |
743 | 752 | } |
744 | 753 |
|
| 754 | + /* processs [MULTILINE_PARSER]'s sections */ |
745 | 755 | ret = multiline_parser_conf_file(cfg, fconf, config); |
746 | 756 | if (ret == -1) { |
747 | 757 | mk_rconf_free(fconf); |
|
0 commit comments