Skip to content

Commit 79e46ae

Browse files
fix
Signed-off-by: deivid.garcia.garcia <deivid.garcia.garcia@gmail.com>
1 parent 614f772 commit 79e46ae

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

plugins/in_tail/tail_file.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,6 +1281,17 @@ int flb_tail_file_append(char *path, struct stat *st, int mode,
12811281
file->offset = offset;
12821282
}
12831283

1284+
if (strlen(path) >= 3 &&
1285+
strcasecmp(&path[strlen(path) - 3], ".gz") == 0) {
1286+
file->decompression_context =
1287+
flb_decompression_context_create(FLB_COMPRESSION_ALGORITHM_GZIP,
1288+
ctx->buf_max_size);
1289+
1290+
if (file->decompression_context == NULL) {
1291+
goto error;
1292+
}
1293+
}
1294+
12841295
/*
12851296
* Duplicate string into 'file' structure, the called function
12861297
* take cares to resolve real-name of the file in case we are
@@ -1298,17 +1309,6 @@ int flb_tail_file_append(char *path, struct stat *st, int mode,
12981309
goto error;
12991310
}
13001311

1301-
if (strlen(path) >= 3 &&
1302-
strcasecmp(&path[strlen(path) - 3], ".gz") == 0) {
1303-
file->decompression_context =
1304-
flb_decompression_context_create(FLB_COMPRESSION_ALGORITHM_GZIP,
1305-
ctx->buf_max_size);
1306-
1307-
if (file->decompression_context == NULL) {
1308-
goto error;
1309-
}
1310-
}
1311-
13121312
/* We keep a copy of the initial filename in orig_name. This is required
13131313
* for path_key to continue working after rotation. */
13141314
file->orig_name = flb_strdup(file->name);

0 commit comments

Comments
 (0)