telegraf/plugins/inputs/file
Joshua Powers 8c49ddccc3
chore: update to go1.19.1 (#11776)
2022-09-08 12:49:36 -06:00
..
dev Add ability to set measurement from matched text in grok parser (#4433) 2018-08-17 13:45:22 -07:00
testdata Support utf-16 in file and tail inputs (#7792) 2020-07-07 12:43:32 -07:00
README.md chore: Fix readme linter errors for input plugins E-L (#11214) 2022-06-07 15:37:08 -06:00
file.go chore: update to go1.19.1 (#11776) 2022-09-08 12:49:36 -06:00
file_test.go feat: migrate grok to new parser style (#11408) 2022-06-30 08:10:27 -06:00
sample.conf chore(inputs_a-l): migrate sample configs into separate files (#11132) 2022-05-18 11:31:52 -05:00

README.md

File Input Plugin

The file plugin parses the complete contents of a file every interval using the selected input data format.

Note: If you wish to parse only newly appended lines use the tail input plugin instead.

Configuration

# Parse a complete file each interval
[[inputs.file]]
  ## Files to parse each interval.  Accept standard unix glob matching rules,
  ## as well as ** to match recursive files and directories.
  files = ["/tmp/metrics.out"]

  ## Character encoding to use when interpreting the file contents.  Invalid
  ## characters are replaced using the unicode replacement character.  When set
  ## to the empty string the data is not decoded to text.
  ##   ex: character_encoding = "utf-8"
  ##       character_encoding = "utf-16le"
  ##       character_encoding = "utf-16be"
  ##       character_encoding = ""
  # character_encoding = ""

  ## Data format to consume.
  ## 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"


  ## Name a tag containing the name of the file the data was parsed from.  Leave empty
  ## to disable. Cautious when file name variation is high, this can increase the cardinality
  ## significantly. Read more about cardinality here:
  ## https://docs.influxdata.com/influxdb/cloud/reference/glossary/#series-cardinality
  # file_tag = ""

Metrics

The format of metrics produced by this plugin depends on the content and data format of the file.