You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f729900
Browse filesBrowse the repository at this point in the historyBrowse files
docs: pipeline: document follow_symlinks for file plugins (#2857)
* docs: pipeline: document follow_symlinks for file plugins
- tail: add the follow_symlinks parameter and a Symbolic links
section: skipped and rejected files, repeated scan errors, scope,
and layouts such as /var/log/containers that need the default.
- file: add the parameter, a Symbolic links section (failed opens
aren't retried, regular files only, mkdir), and rotation behavior.
- blob: add the parameter and a Symbolic links section covering the
scan, recursive search, upload actions, and the output setting.
- s3, azure_blob: add the parameter for blob file part reads.
Refs fluent/fluent-bit#12807
Signed-off-by: Eric D. Schabell <eric@schabell.org>
* docs: pipeline: follow_symlinks: address review findings
- tail, blob: on Windows, matched paths are made absolute first,
which resolves . and .. components before the check.
- file: the Windows delete of old rotated files follows a junction
or symbolic link in the output directory or its parents.
- file: rotation can rename a symbolic link output file and write
to a new regular file instead of rejecting it.
Signed-off-by: Eric D. Schabell <eric@schabell.org>
---------
Signed-off-by: Eric D. Schabell <eric@schabell.org>
Copy file name to clipboardExpand all lines: pipeline/inputs/blob.md
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,7 @@ The plugin supports the following configuration parameters:
15
15
|`alias`| Sets an alias for multiple instances of the same input plugin. This helps when you need to run multiple blob input instances with different configurations. |*none*|
16
16
|`database_file`| Specify a database file to keep track of processed files and their state. This enables the plugin to resume processing from the last known position if Fluent Bit is restarted. |*none*|
17
17
|`exclude_pattern`| Set one or multiple shell patterns separated by commas to exclude files matching certain criteria. For example, `exclude_pattern *.tmp,*.bak` will exclude temporary and backup files from processing. |*none*|
18
+
|`follow_symlinks`| Follow symbolic links when accessing files. Set to `false` to reject file paths that contain a symbolic link or a Windows reparse point in any component. See [Symbolic links](#symbolic-links). |`true`|
18
19
|`log_level`| Specifies the log level for this input plugin. If not set here, the plugin uses the global log level specified in the `service` section. Valid values: `off`, `error`, `warn`, `info`, `debug`, `trace`. |`info`|
19
20
|`log_suppress_interval`| Suppresses log messages from this input plugin that appear similar within a specified time interval. Set to `0` to disable suppression. The value must be specified in seconds. This helps reduce log noise when the same error or warning occurs repeatedly. |`0`|
20
21
|`mem_buf_limit`| Set a memory buffer limit for the input plugin instance in bytes. If the limit is reached, the plugin will pause until the buffer is drained. If set to `0`, the buffer limit is disabled. If the plugin has enabled filesystem buffering, this limit won't apply. The value must be according to the [Unit Size](../../administration/configuring-fluent-bit.md#unit-sizes) specification. |`0`|
@@ -40,6 +41,17 @@ The Blob input plugin periodically scans the specified directory path for binary
40
41
41
42
Binary file content is typically included in the output records, and the exact format depends on the output plugin configuration. The plugin generates one or more records per file, depending on the file size and configuration.
42
43
44
+
## Symbolic links
45
+
46
+
By default, the Blob input follows symbolic links. When `follow_symlinks` is `false`:
47
+
48
+
- Directories that are symbolic links aren't searched. In a recursive scan (a `path` that contains `/**/`), they're skipped without a message, so files in them are never collected. In a non-recursive scan on Linux and macOS, Fluent Bit logs `cannot open <path>` for them. On Windows, directories that are reparse points are skipped without a message.
49
+
- A file is rejected if any component of its path is a symbolic link, or on Windows a junction, mount point, or other reparse point. On Linux and macOS, a path with a `..` component is also rejected. On Windows, Fluent Bit first converts each matched path to an absolute path, which resolves `.` and `..` components, so only the components that remain are checked. Fluent Bit logs `cannot open <path>` and doesn't process the file.
50
+
- A rejected path is checked again on every scan, so the error repeats every `scan_refresh_interval`. Exclude these paths with `exclude_pattern`, or set `log_suppress_interval` to reduce the repeated messages.
51
+
- The `delete` and `add_suffix` actions of `upload_success_action` and `upload_failure_action` don't follow symbolic links.
52
+
53
+
The [Amazon S3](../outputs/s3.md) and [Azure Blob](../outputs/azure_blob.md) outputs read the files again when they upload them, and have their own `follow_symlinks` parameter. To keep the whole pipeline from following symbolic links, set `follow_symlinks` to `false` on both the input and the output. When an output rejects a file this way, it doesn't retry the file until `upload_part_freshness_limit` expires, and the input's `upload_failure_action` isn't triggered.
54
+
43
55
## Database file
44
56
45
57
The database file enables the plugin to track which files have been processed and maintain state across Fluent Bit restarts. This is similar to how the [Tail input plugin](../inputs/tail.md#database-file) uses a database file.
Copy file name to clipboardExpand all lines: pipeline/inputs/tail.md
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,6 +28,7 @@ The plugin supports the following configuration parameters:
28
28
|`exclude_path`| Set one or multiple shell patterns separated by commas to exclude files matching certain criteria. For example, `exclude_path *.gz,*.zip`. |_none_|
29
29
|`exit_on_eof`| When reading a file, exit as soon as it reaches the end of the file. Used for bulk load and tests. |`false`|
30
30
|`file_cache_advise`| Set the `posix_fadvise` in `POSIX_FADV_DONTNEED` mode. This reduces the usage of the kernel file cache. This option is ignored if not running on Linux. |`true`|
31
+
|`follow_symlinks`| Follow symbolic links when accessing files. Set to `false` to reject file paths that contain a symbolic link or a Windows reparse point in any component. See [Symbolic links](#symbolic-links). |`true`|
31
32
|`generic.encoding`| Set the non-Unicode encoding of the file data. Supported values: `ShiftJIS`, `UHC`, `GBK`, `GB18030`, `Big5`, `Win866`, `Win874`, `Win1250`, `Win1251`, `Win1252`, `Win1253`, `Win1254`, `Win1255`, and `Win1256`. |_none_|
32
33
|`ignore_active_older_files`| Ignore files that are older than the value set in `ignore_older` even if the file is being ingested. |`false`|
33
34
|`ignore_older`| Ignores files older than `ignore_older`. Supports `m`, `h`, `d` (minutes, hours, days) syntax. | Read all. |
@@ -507,6 +508,17 @@ While file rotation is handled, there are risks of potential log loss when using
507
508
508
509
{% endhint %}
509
510
511
+
## Symbolic links
512
+
513
+
By default, the Tail input follows symbolic links. When `follow_symlinks` is `false`, Fluent Bit opens each directory in a file's path without following links, and rejects the file if any component of the path is a symbolic link. On Windows, it also rejects junctions, mount points, and other reparse points. On Linux and macOS, a path with a `..` component is also rejected. On Windows, Fluent Bit first converts each matched path to an absolute path, which resolves `.` and `..` components, so only the components that remain are checked.
514
+
515
+
- On Linux and macOS, a file matched by `path` that's itself a symbolic link is skipped. The only message is `skip (invalid) entry=<path>` at the `debug` log level.
516
+
- If a directory in the path is a symbolic link, or on Windows if the file is a symbolic link, Fluent Bit logs `cannot open <path>` and doesn't tail the file. The file is checked again on every scan, so the error repeats every `refresh_interval`. Exclude these paths with `exclude_path`, or set `log_suppress_interval` to reduce the repeated messages.
517
+
518
+
The option applies to the file scan and to opening files. Rotation detection, file watching, and the database file still follow symbolic links.
519
+
520
+
Some common log locations rely on symbolic links. For example, the files in `/var/log/containers` on Kubernetes nodes are symbolic links, and `/var` and `/tmp` on macOS are symbolic links. Keep the default value for paths like these. The [Kubernetes](../filters/kubernetes.md) filter reads metadata from tags based on `/var/log/containers` file names by default, so keep `follow_symlinks` set to `true` when you use it with that layout.
521
+
510
522
## Windows path encoding
511
523
512
524
The `windows.path_encoding` parameter is available in Fluent Bit version 5.1 and greater, and applies only to Windows.
Copy file name to clipboardExpand all lines: pipeline/outputs/azure_blob.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,6 +44,7 @@ Fluent Bit exposes the following configuration properties.
44
44
|`emulator_mode`| To send data to an Azure emulator service like [Azurite](https://github.com/Azure/Azurite), enable this option to format the requests in the expected format. |`false`|
45
45
|`endpoint`| When using an emulator, this option lets you specify the absolute HTTP address of such service. For example, `http://127.0.0.1:10000`. |_none_|
46
46
|`file_delivery_attempt_limit`| Maximum number of delivery attempts for a file. |`1`|
47
+
|`follow_symlinks`| Follow symbolic links when reading files from the [Blob](../inputs/blob.md) input. Set to `false` to reject paths with a symlink, a Windows reparse point, or `..`. A rejected part logs `cannot read file part <path>` and isn't retried until `upload_part_freshness_limit` expires. |`true`|
47
48
|`io_timeout`| Network I/O timeout used when `buffering_enabled` is `true` and `net.io_timeout` isn't set. In v5.2 or later, an explicit `net.io_timeout`, including `0s`, takes precedence. Earlier versions always used `io_timeout` when buffering was enabled. |`60s`|
48
49
|`part_delivery_attempt_limit`| Maximum number of delivery attempts for a file part. |`1`|
49
50
|`part_size`| Size of each part when uploading blob files. |`25M`|
Copy file name to clipboardExpand all lines: pipeline/outputs/file.md
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,7 @@ The _File_ output plugin lets you write the data received through the input plug
14
14
|`fallback_file`| Static filename used when a `fallback` action is applied. Required whenever `path` or `file` uses a record accessor or a `strftime` placeholder. See [Dynamic destinations](#dynamic-destinations). |_none_|
15
15
|`fallback_path`| Static directory path used together with `fallback_file` when a `fallback` action is applied. |_none_|
16
16
|`file`| Set filename to store the records. If not set, the filename will be the `tag` associated with the records. Supports [record accessor](../../administration/configuring-fluent-bit/classic-mode/record-accessor.md) expressions. When `enable_strftime` is `true`, `strftime` placeholders are expanded using the UTC event timestamp. |_none_|
17
+
|`follow_symlinks`| Follow symbolic links when accessing files. Set to `false` to reject output paths that contain a symbolic link or a Windows reparse point in any component. See [Symbolic links](#symbolic-links). |`true`|
17
18
|`format`| The [format](#format) of the file content. |_none_|
18
19
|`max_dynamic_files`| Maximum number of distinct destinations that record accessor expressions and `strftime` placeholders can resolve to. Tag-derived filenames count when `path` is dynamic, or, in v5.2 or later, when `path` isn't dynamic, `file` isn't set, and this key is set explicitly. Set to `0` for unlimited. See [Destination limits](#destination-limits). |`1024`|
19
20
|`mkdir`| Recursively create output directory if it doesn't exist. Permissions set to `0755`. |`false`|
@@ -148,6 +149,8 @@ The plugin retains up to `rotate_max_files` rotated files per output file. When
148
149
149
150
Log rotation works with all supported output [formats](#format): default (`out_file`), `plain`, `csv`, `ltsv`, `template`, and `msgpack`. File operations are thread-safe, so rotation can be used alongside multiple [workers](../../administration/multithreading.md#outputs).
150
151
152
+
When `follow_symlinks` is `false`, renaming, compressing, and deleting rotated files don't follow symbolic links, except that deleting the oldest rotated files on Windows uses a normal delete. That delete follows a junction or symbolic link in the output directory or one of its parent directories.
153
+
151
154
### Log rotation example
152
155
153
156
The following configuration writes CPU metrics to file with rotation enabled. Files are rotated at 50 MB and the five most recent rotated files are retained with gzip compression:
@@ -194,6 +197,16 @@ pipeline:
194
197
{% endtab %}
195
198
{% endtabs %}
196
199
200
+
## Symbolic links
201
+
202
+
By default, the File output follows symbolic links. When `follow_symlinks` is `false`, Fluent Bit opens each directory in the output path without following links:
203
+
204
+
- If any component of the path is a symbolic link, or on Windows a junction, mount point, or other reparse point, the file isn't opened. A path with a `..` component is also rejected, and the output file must be a regular file. Fluent Bit logs `error opening: <path>`, and the records in that flush aren't retried.
205
+
- With `mkdir` set to `true`, missing directories are created with permissions `0755`, subject to the process `umask`. On Windows, the permissions value is ignored.
206
+
-[Log rotation](#log-rotation) follows the same rules. However, Fluent Bit follows the link when it checks the size of the output file. If rotation is due and the output file is a symbolic link, rotation renames the link itself, and Fluent Bit then creates a regular file at the original path and writes the records to it.
207
+
208
+
Some common locations rely on symbolic links, such as `/var` and `/tmp` on macOS. Keep the default value if the output path goes through a symbolic link.
209
+
197
210
## Dynamic destinations
198
211
199
212
Dynamic destinations are available in Fluent Bit version 5.1 and greater.
Copy file name to clipboardExpand all lines: pipeline/outputs/s3.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,6 +51,7 @@ The [Prometheus success/retry/error metrics values](../../administration/monitor
51
51
|`endpoint`| Custom endpoint for the S3 API. Endpoints can contain scheme and port. Set this parameter to send data to an S3-compatible object store other than Amazon S3, such as MinIO or Google Cloud Storage. Requests use path-style addressing (`endpoint/bucket/key`) and are signed with the configured `region`. |_none_|
52
52
|`external_id`| Specify an external ID for the STS API. Can be used with the `role_arn` parameter if your role requires an external ID. |_none_|
|`follow_symlinks`| Follow symbolic links when reading files from the [Blob](../inputs/blob.md) input. Set to `false` to reject paths with a symlink, a Windows reparse point, or `..`. A rejected part logs `cannot read file part <path>` and isn't retried until `upload_part_freshness_limit` expires. |`true`|
54
55
|`format`| Set the output format. Supported values: `json_lines`, `otlp_json`, `parquet`. When set to `parquet`, records are converted to Apache Parquet columnar format (requires Apache Arrow Parquet support at compile time). The `compression` option controls the page-level `codec` inside the Parquet file. When set to `otlp_json`, the `log_key` option isn't supported and only `logs` event chunks are converted. |`json_lines`|
55
56
|`host`| IP address or hostname of the target HTTP server. |`127.0.0.1`|
56
57
|`json_date_format`| Specify the format of the date. Accepted values: `double`, `epoch`, `epoch_ms`, `iso8601` (2018-05-30T09:39:52.000681Z), `_java_sql_timestamp_` (2018-05-30 09:39:52.000681). |_none_|
0 commit comments