Skip to content

Commit

Permalink
in_tail: skip_empty_line supports CRLF line
Browse files Browse the repository at this point in the history
Signed-off-by: Takahiro Yamashita <[email protected]>
  • Loading branch information
nokute78 authored and edsiper committed Mar 25, 2024
1 parent ac12a20 commit 44672f6
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions plugins/in_tail/tail_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -479,11 +479,17 @@ static int process_content(struct flb_tail_file *file, size_t *bytes)
* property to revert this behavior if some user is affected by
* this change.
*/

if (len == 0 && ctx->skip_empty_lines) {
data++;
processed_bytes++;
continue;
if (ctx->skip_empty_lines) {
if (len == 0) { /* LF */
data++;
processed_bytes++;
continue;
}
else if (len == 1 && data[0] == '\r') { /* CR LF */
data += 2;
processed_bytes += 2;
continue;
}
}

/* Process '\r\n' */
Expand Down

0 comments on commit 44672f6

Please sign in to comment.