Telegraf input data formats
Telegraf input plugins use parsers to convert incoming data into
Telegraf metrics.
Any input plugin that supports the data_format option can use it to
select a parser:
[[inputs.file]]
files = ["example.json"]
## Data format to consume.
data_format = "json_v2"Each parser has its own configuration options for describing your data’s schema and how it maps to metric names, tags, fields, and timestamps. For guidance on choosing and configuring a parser, including timestamp format reference and worked examples, see Parse incoming data.
Choose a JSON parser
Three parsers read JSON data. They differ in how much control they give you and how they handle nested structures:
| Parser | Best for | Value selection | Type control |
|---|---|---|---|
| json | Flat objects | Flattens everything; optional GJSON json_query | Numbers only by default; strings and booleans via json_string_fields |
| json_v2 | Existing configurations that select nested values | GJSON paths | Per-value type option |
| xpath_json | Nested documents and arrays; new configurations | XPath 1.0 queries | XPath conversion functions or native JSON types |
We recommend xpath_json over json_v2 for new
configurations, especially when working with arrays.
Use json when your data is flat and you don’t need type control.
Available parsers
Avro
Use the avro input data format to parse Avro binary or JSON data into Telegraf metrics.
Binary
Use the binary input data format with user-specified configurations to parse binary protocols into Telegraf metrics.
Collectd
Use the collectd input data format to parse collectd network binary protocol to create tags for host, instance, type, and type instance.
CSV
Use the csv input data format to parse comma-separated values into Telegraf metrics.
Dropwizard
Use the dropwizard input data format to parse Dropwizard JSON representations into Telegraf metrics.
Form URL-encoded
Use the form-urlencoded data format to parse application/x-www-form-urlencoded data, such as HTTP query strings.
Graphite
Use the graphite input data format to parse Graphite dot buckets into Telegraf metrics.
Grok
Use the grok data format to parse line-delimited data using a regular expression-like language.
InfluxDB line protocol
Use the influx line protocol input data format to parse InfluxDB metrics directly into Telegraf metrics.
JSON
Use the json input data format to parse flat JSON objects, or an array of flat objects, into Telegraf metrics. Includes a complete option reference and worked examples.
JSON v2
Use the json_v2 input data format to select values out of JSON documents with GJSON paths and map them to Telegraf metric names, tags, fields, and timestamps. Includes a complete option reference and worked examples.
Logfmt
Use the logfmt input data format to parse logfmt data into Telegraf metrics.
Nagios
Use the nagios input data format to parse the output of Nagios plugins into Telegraf metrics.
OpenMetrics
Use the openmetrics input data format to parse OpenMetrics text format into Telegraf metrics.
OpenTSDB Telnet PUT API
Use the opentsdb data format to parse OpenTSDB Telnet PUT API data into Telegraf metrics.
Parquet
Use the parquet input data format to parse Apache Parquet files into Telegraf metrics.
Prometheus
Use the prometheus input data format to parse Prometheus text exposition format into Telegraf metrics.
Prometheus Remote Write
Use the prometheusremotewrite input data format to parse Prometheus Remote Write samples into Telegraf metrics.
Value
Use the value input data format to parse single values into Telegraf metrics.
Wavefront
Use the wavefront input data format to parse Wavefront data into Telegraf metrics.
XML
Use the xml input data format and XPath expressions to parse XML data into Telegraf metrics.
XPath CBOR
Use the xpath_cbor input data format and XPath expressions to parse Concise Binary Object Representation (CBOR) data into Telegraf metrics.
XPath JSON
Use the xpath_json input data format and XPath expressions to parse JSON into Telegraf metrics. Includes the JSON-to-tree mapping, a complete option reference, and verified examples.
XPath MessagePack
Use the xpath_msgpack input data format and XPath expressions to parse MessagePack data into Telegraf metrics.
XPath Protocol Buffers
Use the xpath_protobuf input data format and XPath expressions to parse Protocol Buffers data into Telegraf metrics.
Was this page helpful?
Thank you for your feedback!
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for Telegraf and this documentation. To find support, use the following resources:
Customers with an annual or support contract can contact InfluxData Support.