Manually configure Telegraf

Use the Telegraf influxdb_v2 output plugin to collect and write metrics into an InfluxDB 2.7 bucket. This article describes how to enable the influxdb_v2 output plugin in new and existing Telegraf configurations, then start Telegraf using the custom configuration file.

View the requirements for using Telegraf with InfluxDB 2.7.

Configure Telegraf input and output plugins

Configure Telegraf input and output plugins in the Telegraf configuration file (typically named telegraf.conf). Input plugins collect metrics. Output plugins define destinations where metrics are sent.

See Telegraf plugins for a complete list of available plugins.

Manually add Telegraf plugins

To manually add any of the available Telegraf plugins, follow the steps below.

  1. Find the plugin you want to enable from the complete list of available Telegraf plugins.
  2. Click View to the right of the plugin name to open the plugin page on GitHub. For example, view the MQTT plugin GitHub page here.
  3. Copy and paste the example configuration into your Telegraf configuration file (typically named telegraf.conf).

Enable and configure the InfluxDB v2 output plugin

To send data to an InfluxDB 2.7 instance, enable in the influxdb_v2 output plugin in the telegraf.conf.

To find an example InfluxDB v2 output plugin configuration in the UI:

  1. In the navigation menu on the left, select Data (Load Data) > Telegraf.

  2. Click InfluxDB Output Plugin.

  3. Click Copy to Clipboard to copy the example configuration or Download Config to save a copy.

  4. Paste the example configuration into your telegraf.conf and specify the options below.

The InfluxDB output plugin configuration contains the following options:


An array of URLs for your InfluxDB 2.7 instances. See InfluxDB URLs for information about which URLs to use. requires HTTPS.


Your InfluxDB 2.7 API token. For information about viewing tokens, see View tokens.

Avoid storing tokens in telegraf.conf

We recommend storing your tokens by setting the INFLUX_TOKEN environment variable and including the environment variable in your configuration file.

export INFLUX_TOKEN=YourAuthenticationToken
$env:INFLUX_TOKEN = "YourAuthenticationToken"
set INFLUX_TOKEN=YourAuthenticationToken
# Make sure to include a space character at the end of this command.

See the example telegraf.conf below.


The name of the organization that owns the target bucket.


The name of the bucket to write data to.

Example influxdb_v2 configuration

The example below illustrates an influxdb_v2 configuration.

# ...

  urls = ["http://localhost:8086"]
  token = "$INFLUX_TOKEN"
  organization = "example-org"
  bucket = "example-bucket"

# ...
Write to InfluxDB v1.x and v2.x

If a Telegraf agent is already writing to an InfluxDB v1.x database, enabling the InfluxDB v2 output plugin will write data to both v1.x and 2.7 instances.

Add a custom Telegraf configuration to InfluxDB

To add a custom or manually configured Telegraf configuration to your collection of Telegraf configurations in InfluxDB, use the influx telegrafs create or influx telegrafs update commands. For more information, see:

Start Telegraf

Start the Telegraf service using the --config flag to specify the location of your telegraf.conf.

telegraf --config /path/to/custom/telegraf.conf

Was this page helpful?

Thank you for your feedback!

Set your InfluxDB URL

Introducing InfluxDB 3.0

The new core of InfluxDB built with Rust and Apache Arrow. Available today in InfluxDB Cloud Dedicated.

Learn more

State of the InfluxDB Cloud Serverless documentation

The new documentation for InfluxDB Cloud Serverless is a work in progress. We are adding new information and content almost daily. Thank you for your patience!

If there is specific information you’re looking for, please submit a documentation issue.