Documentation

CSV output data format

Use the csv output data format (serializer) to convert Telegraf metrics into CSV (Comma-Separated Values) lines.

Configuration

[[outputs.file]]
  files = ["stdout", "/tmp/metrics.out"]

  ## Data format to output.
  data_format = "csv"

  ## Timestamp format.
  ## Default is Unix epoch time. Use Go time layout for custom formats.
  ## See: https://golang.org/pkg/time/#Time.Format
  # csv_timestamp_format = "unix"

  ## Field separator character.
  # csv_separator = ","

  ## Output the CSV header in the first line.
  ## Enable when writing to a new file.
  ## Disable when appending or using stateless outputs to prevent
  ## headers appearing between data lines.
  # csv_header = false

  ## Prefix tag and field columns with "tag_" and "field_" respectively.
  # csv_column_prefix = false

  ## Specify column order.
  ## Use "tag." prefix for tags, "field." prefix for fields,
  ## "name" for measurement name, and "timestamp" for the timestamp.
  ## Only specified columns are included; others are dropped.
  ## Default order: timestamp, name, tags (alphabetical), fields (alphabetical)
  # csv_columns = ["timestamp", "name", "tag.host", "field.value"]

Configuration options

OptionTypeDefaultDescription
csv_timestamp_formatstring"unix"Timestamp format (Unix epoch or Go time layout)
csv_separatorstring","Field separator character
csv_headerbooleanfalseOutput CSV header row
csv_column_prefixbooleanfalsePrefix columns with tag_ or field_
csv_columnsarray[]Explicit column order (empty = all columns)

Examples

Basic CSV output

[[outputs.file]]
  files = ["/tmp/metrics.csv"]
  data_format = "csv"
  csv_header = true

Input metric:

cpu,host=server01 usage_idle=98.5,usage_user=1.2 1640000000000000000

Output:

timestamp,name,host,usage_idle,usage_user
1640000000,cpu,server01,98.5,1.2

Custom column order

[[outputs.file]]
  files = ["/tmp/metrics.csv"]
  data_format = "csv"
  csv_header = true
  csv_columns = ["timestamp", "tag.host", "field.usage_idle"]

Output:

timestamp,host,usage_idle
1640000000,server01,98.5

Custom timestamp format

[[outputs.file]]
  files = ["/tmp/metrics.csv"]
  data_format = "csv"
  csv_timestamp_format = "2006-01-02T15:04:05Z07:00"

Was this page helpful?

Thank you for your feedback!


New in InfluxDB 3.8

Key enhancements in InfluxDB 3.8 and the InfluxDB 3 Explorer 1.6.

See the Blog Post

InfluxDB 3.8 is now available for both Core and Enterprise, alongside the 1.6 release of the InfluxDB 3 Explorer UI. This release is focused on operational maturity and making InfluxDB easier to deploy, manage, and run reliably in production.

For more information, check out:

InfluxDB Docker latest tag changing to InfluxDB 3 Core

On February 3, 2026, the latest tag for InfluxDB Docker images will point to InfluxDB 3 Core. To avoid unexpected upgrades, use specific version tags in your Docker deployments.

If using Docker to install and run InfluxDB, the latest tag will point to InfluxDB 3 Core. To avoid unexpected upgrades, use specific version tags in your Docker deployments. For example, if using Docker to run InfluxDB v2, replace the latest version tag with a specific version tag in your Docker pull command–for example:

docker pull influxdb:2