@@ -183,9 +183,6 @@ static inline int pack_line(struct flb_syslog *ctx,
183
183
}
184
184
185
185
if (result == FLB_EVENT_ENCODER_SUCCESS ) {
186
- flb_input_log_append (ctx -> ins , NULL , 0 ,
187
- ctx -> log_encoder -> output_buffer ,
188
- ctx -> log_encoder -> output_length );
189
186
result = 0 ;
190
187
}
191
188
else {
@@ -194,8 +191,6 @@ static inline int pack_line(struct flb_syslog *ctx,
194
191
result = -1 ;
195
192
}
196
193
197
- flb_log_event_encoder_reset (ctx -> log_encoder );
198
-
199
194
if (modified_data_buffer != NULL ) {
200
195
flb_free (modified_data_buffer );
201
196
}
@@ -221,6 +216,8 @@ int syslog_prot_process(struct syslog_conn *conn)
221
216
eof = conn -> buf_data ;
222
217
end = conn -> buf_data + conn -> buf_len ;
223
218
219
+ flb_log_event_encoder_reset (ctx -> log_encoder );
220
+
224
221
/* Always parse while some remaining bytes exists */
225
222
while (eof < end ) {
226
223
/* Lookup the ending byte */
@@ -281,6 +278,12 @@ int syslog_prot_process(struct syslog_conn *conn)
281
278
conn -> buf_data [conn -> buf_len ] = '\0' ;
282
279
}
283
280
281
+ if (ctx -> log_encoder -> output_length > 0 ) {
282
+ flb_input_log_append (ctx -> ins , NULL , 0 ,
283
+ ctx -> log_encoder -> output_buffer ,
284
+ ctx -> log_encoder -> output_length );
285
+ }
286
+
284
287
return 0 ;
285
288
}
286
289
@@ -300,6 +303,8 @@ int syslog_prot_process_udp(struct syslog_conn *conn)
300
303
ctx = conn -> ctx ;
301
304
connection = conn -> connection ;
302
305
306
+ flb_log_event_encoder_reset (ctx -> log_encoder );
307
+
303
308
ret = flb_parser_do (ctx -> parser , buf , size ,
304
309
& out_buf , & out_size , & out_time );
305
310
if (ret >= 0 ) {
@@ -320,5 +325,11 @@ int syslog_prot_process_udp(struct syslog_conn *conn)
320
325
return -1 ;
321
326
}
322
327
328
+ if (ctx -> log_encoder -> output_length > 0 ) {
329
+ flb_input_log_append (ctx -> ins , NULL , 0 ,
330
+ ctx -> log_encoder -> output_buffer ,
331
+ ctx -> log_encoder -> output_length );
332
+ }
333
+
323
334
return 0 ;
324
335
}
0 commit comments