File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -267,6 +267,7 @@ int flb_ml_rule_process(struct flb_ml_parser *ml_parser,
267267 msgpack_object * val_pattern )
268268{
269269 int ret ;
270+ int len ;
270271 char * buf_data = NULL ;
271272 size_t buf_size = 0 ;
272273 struct mk_list * head ;
@@ -330,7 +331,18 @@ int flb_ml_rule_process(struct flb_ml_parser *ml_parser,
330331 (unsigned char * ) buf_data , buf_size );
331332 if (ret ) {
332333 /* Regex matched */
333- flb_sds_cat_safe (& group -> buf , buf_data , buf_size );
334+
335+ len = flb_sds_len (group -> buf );
336+ if (len >= 1 && group -> buf [len - 1 ] != '\n' ) {
337+ flb_sds_cat_safe (& group -> buf , "\n" , 1 );
338+ }
339+
340+ if (buf_size == 0 ) {
341+ flb_sds_cat_safe (& group -> buf , "\n" , 1 );
342+ }
343+ else {
344+ flb_sds_cat_safe (& group -> buf , buf_data , buf_size );
345+ }
334346 rule = st -> rule ;
335347 break ;
336348 }
You can’t perform that action at this time.
0 commit comments