2019-06-04 08:38:21 +08:00
|
|
|
# File Output Plugin
|
2017-02-20 18:50:39 +08:00
|
|
|
|
|
|
|
|
This plugin writes telegraf metrics to files
|
|
|
|
|
|
2022-10-27 03:58:36 +08:00
|
|
|
## Global configuration options <!-- @/docs/includes/plugin_config.md -->
|
|
|
|
|
|
|
|
|
|
In addition to the plugin-specific configuration settings, plugins support
|
|
|
|
|
additional global and plugin configuration settings. These settings are used to
|
|
|
|
|
modify metrics, tags, and field or create aliases and configure ordering, etc.
|
|
|
|
|
See the [CONFIGURATION.md][CONFIGURATION.md] for more details.
|
|
|
|
|
|
2023-01-12 23:55:21 +08:00
|
|
|
[CONFIGURATION.md]: ../../../docs/CONFIGURATION.md#plugins
|
2022-10-27 03:58:36 +08:00
|
|
|
|
2021-11-25 02:47:33 +08:00
|
|
|
## Configuration
|
2019-06-04 08:38:21 +08:00
|
|
|
|
2022-05-25 22:48:59 +08:00
|
|
|
```toml @sample.conf
|
2022-04-08 05:55:03 +08:00
|
|
|
# Send telegraf metrics to file(s)
|
2017-02-20 18:50:39 +08:00
|
|
|
[[outputs.file]]
|
|
|
|
|
## Files to write to, "stdout" is a specially handled file.
|
|
|
|
|
files = ["stdout", "/tmp/metrics.out"]
|
|
|
|
|
|
2019-11-27 07:46:31 +08:00
|
|
|
## Use batch serialization format instead of line based delimiting. The
|
|
|
|
|
## batch format allows for the production of non line based output formats and
|
2020-05-14 15:41:58 +08:00
|
|
|
## may more efficiently encode and write metrics.
|
2019-11-27 07:46:31 +08:00
|
|
|
# use_batch_format = false
|
|
|
|
|
|
2019-06-04 08:38:21 +08:00
|
|
|
## The file will be rotated after the time interval specified. When set
|
|
|
|
|
## to 0 no time based rotation is performed.
|
|
|
|
|
# rotation_interval = "0h"
|
|
|
|
|
|
|
|
|
|
## The logfile will be rotated when it becomes larger than the specified
|
|
|
|
|
## size. When set to 0 no size based rotation is performed.
|
|
|
|
|
# rotation_max_size = "0MB"
|
|
|
|
|
|
|
|
|
|
## Maximum number of rotated archives to keep, any older logs are deleted.
|
|
|
|
|
## If set to -1, no archives are removed.
|
|
|
|
|
# rotation_max_archives = 5
|
2019-06-02 08:11:47 +08:00
|
|
|
|
2017-02-20 18:50:39 +08:00
|
|
|
## Data format to output.
|
2017-04-28 05:59:18 +08:00
|
|
|
## Each data format has its own unique set of configuration options, read
|
2017-02-20 18:50:39 +08:00
|
|
|
## more about them here:
|
|
|
|
|
## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_OUTPUT.md
|
|
|
|
|
data_format = "influx"
|
2023-07-06 23:07:56 +08:00
|
|
|
|
2024-01-06 05:34:02 +08:00
|
|
|
## Compress output data with the specified algorithm.
|
2023-07-06 23:07:56 +08:00
|
|
|
## If empty, compression will be disabled and files will be plain text.
|
|
|
|
|
## Supported algorithms are "zstd", "gzip" and "zlib".
|
|
|
|
|
# compression_algorithm = ""
|
|
|
|
|
|
|
|
|
|
## Compression level for the algorithm above.
|
|
|
|
|
## Please note that different algorithms support different levels:
|
|
|
|
|
## zstd -- supports levels 1, 3, 7 and 11.
|
|
|
|
|
## gzip -- supports levels 0, 1 and 9.
|
|
|
|
|
## zlib -- supports levels 0, 1, and 9.
|
|
|
|
|
## By default the default compression level for each algorithm is used.
|
|
|
|
|
# compression_level = -1
|
2017-02-20 18:50:39 +08:00
|
|
|
```
|