2021-03-03 06:30:59 +08:00
|
|
|
# Directory Monitor Input Plugin
|
|
|
|
|
|
2022-06-08 05:10:18 +08:00
|
|
|
This plugin monitors a single directory (without looking at sub-directories),
|
|
|
|
|
and takes in each file placed in the directory. The plugin will gather all
|
2022-06-13 22:24:17 +08:00
|
|
|
files in the directory at the configured interval, and parse the ones that
|
|
|
|
|
haven't been picked up yet.
|
2021-03-03 06:30:59 +08:00
|
|
|
|
2022-06-08 05:10:18 +08:00
|
|
|
This plugin is intended to read files that are moved or copied to the monitored
|
|
|
|
|
directory, and thus files should also not be used by another process or else
|
|
|
|
|
they may fail to be gathered. Please be advised that this plugin pulls files
|
|
|
|
|
directly after they've been in the directory for the length of the configurable
|
|
|
|
|
`directory_duration_threshold`, and thus files should not be written 'live' to
|
|
|
|
|
the monitored directory. If you absolutely must write files directly, they must
|
|
|
|
|
be guaranteed to finish writing before the `directory_duration_threshold`.
|
2021-03-03 06:30:59 +08:00
|
|
|
|
2021-11-25 02:56:26 +08:00
|
|
|
## Configuration
|
2021-03-03 06:30:59 +08:00
|
|
|
|
2022-05-24 21:49:47 +08:00
|
|
|
```toml @sample.conf
|
2022-04-08 06:01:21 +08:00
|
|
|
# Ingests files in a directory and then moves them to a target directory.
|
2021-03-03 06:30:59 +08:00
|
|
|
[[inputs.directory_monitor]]
|
|
|
|
|
## The directory to monitor and read files from.
|
|
|
|
|
directory = ""
|
|
|
|
|
#
|
|
|
|
|
## The directory to move finished files to.
|
|
|
|
|
finished_directory = ""
|
|
|
|
|
#
|
|
|
|
|
## The directory to move files to upon file error.
|
|
|
|
|
## If not provided, erroring files will stay in the monitored directory.
|
|
|
|
|
# error_directory = ""
|
|
|
|
|
#
|
|
|
|
|
## The amount of time a file is allowed to sit in the directory before it is picked up.
|
|
|
|
|
## This time can generally be low but if you choose to have a very large file written to the directory and it's potentially slow,
|
|
|
|
|
## set this higher so that the plugin will wait until the file is fully copied to the directory.
|
2021-11-25 02:56:26 +08:00
|
|
|
# directory_duration_threshold = "50ms"
|
2021-03-03 06:30:59 +08:00
|
|
|
#
|
|
|
|
|
## A list of the only file names to monitor, if necessary. Supports regex. If left blank, all files are ingested.
|
|
|
|
|
# files_to_monitor = ["^.*\.csv"]
|
|
|
|
|
#
|
|
|
|
|
## A list of files to ignore, if necessary. Supports regex.
|
|
|
|
|
# files_to_ignore = [".DS_Store"]
|
|
|
|
|
#
|
|
|
|
|
## Maximum lines of the file to process that have not yet be written by the
|
|
|
|
|
## output. For best throughput set to the size of the output's metric_buffer_limit.
|
|
|
|
|
## Warning: setting this number higher than the output's metric_buffer_limit can cause dropped metrics.
|
|
|
|
|
# max_buffered_metrics = 10000
|
|
|
|
|
#
|
|
|
|
|
## The maximum amount of file paths to queue up for processing at once, before waiting until files are processed to find more files.
|
|
|
|
|
## Lowering this value will result in *slightly* less memory use, with a potential sacrifice in speed efficiency, if absolutely necessary.
|
2021-11-25 02:56:26 +08:00
|
|
|
# file_queue_size = 100000
|
2021-03-03 06:30:59 +08:00
|
|
|
#
|
2021-10-08 04:38:20 +08:00
|
|
|
## Name a tag containing the name of the file the data was parsed from. Leave empty
|
2021-11-25 02:56:26 +08:00
|
|
|
## to disable. Cautious when file name variation is high, this can increase the cardinality
|
|
|
|
|
## significantly. Read more about cardinality here:
|
2021-10-08 04:38:20 +08:00
|
|
|
## https://docs.influxdata.com/influxdb/cloud/reference/glossary/#series-cardinality
|
|
|
|
|
# file_tag = ""
|
|
|
|
|
#
|
2022-06-13 22:24:17 +08:00
|
|
|
## Specify if the file can be read completely at once or if it needs to be read line by line (default).
|
|
|
|
|
## Possible values: "line-by-line", "at-once"
|
|
|
|
|
# parse_method = "line-by-line"
|
|
|
|
|
#
|
2021-03-03 06:30:59 +08:00
|
|
|
## The dataformat to be read from the files.
|
|
|
|
|
## Each data format has its own unique set of configuration options, read
|
|
|
|
|
## more about them here:
|
|
|
|
|
## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md
|
|
|
|
|
data_format = "influx"
|
|
|
|
|
```
|
2022-06-13 22:24:17 +08:00
|
|
|
|
|
|
|
|
## Metrics
|
|
|
|
|
|
|
|
|
|
The format of metrics produced by this plugin depends on the content and data
|
|
|
|
|
format of the file.
|