Configure Telegraf to write to InfluxDB 3 Core
Use the Telegraf influxdb_v3 output plugin
to collect and write metrics to InfluxDB 3 Core.
This plugin uses the InfluxDB 3 Core native HTTP API
/api/v3/write_lp endpoint
and requires Telegraf 1.38 or greater.
Learn how to enable and configure the influxdb_v3 output plugin to write data
to InfluxDB 3 Core.
If you use an earlier version of Telegraf or bring an existing Telegraf
configuration from InfluxDB v1 or v2, you can use the
influxdb_v2 or
influxdb (v1) output plugins to write
to InfluxDB 3 Core
compatibility APIs.
View the requirements for using Telegraf with InfluxDB 3 Core.
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.
This guide assumes you have already installed InfluxDB 3 Core and have been through the getting started guide.
Add Telegraf plugins
To add any of the available Telegraf plugins, follow the steps below.
- Find the plugin you want to enable from the complete list of available Telegraf plugins.
- Click View to the right of the plugin name to open the plugin page on GitHub. For example, view the MQTT plugin GitHub page.
- Copy and paste the example configuration into your Telegraf configuration file
(typically named
telegraf.conf).
Enable and configure the InfluxDB v3 output plugin
To send data to InfluxDB 3 Core, enable the
influxdb_v3 output plugin
in the telegraf.conf.
[[outputs.influxdb_v3]]
urls = ["http://localhost:8181"]
token = "AUTH_TOKEN"
database = "DATABASE_NAME"Replace the following:
DATABASE_NAME: the name of the database to write data toAUTH_TOKEN: your InfluxDB 3 Core token . Store this in a secret store or environment variable to avoid exposing the raw token string.
The InfluxDB v3 output plugin configuration contains the following options:
urls
An array of URL strings. To write to InfluxDB 3 Core, include your InfluxDB 3 Core URL:
["http://localhost:8181"]If you specify multiple URLs, Telegraf randomly selects one of them for each write interval and fails over to another if the write doesn’t succeed.
token
Your InfluxDB 3 Core authorization token.
Store your authorization token as an environment variable
To prevent a plain text token in your Telegraf configuration file, we recommend that you store the token as an environment variable and then reference the environment variable in your configuration file using string interpolation. For example:
[[outputs.influxdb_v3]]
urls = ["http://localhost:8181"]
token = "${INFLUX_TOKEN}"
# ...database
The name of the InfluxDB 3 Core database to write data to.
Additional plugin options
The plugin provides additional options for controlling write behavior, including:
database_tag: the metric tag to use to determine the destination database, overridingdatabase.sync: set tofalseto acknowledge writes before WAL persistence completes, which reduces write latency but increases the risk of data loss. Default istrue. See Use no_sync for immediate write responses.content_encoding: the plugin compresses write request bodies with gzip by default.
For all plugin options, see the
influxdb_v3 output plugin reference.
Use the InfluxDB v2 output plugin
If you bring an existing InfluxDB v2 write workload or use a Telegraf version
earlier than 1.38, use the
influxdb_v2 output plugin
to write to InfluxDB 3 Core through the InfluxDB
v2 compatibility API.
[[outputs.influxdb_v2]]
urls = ["http://localhost:8181"]
token = "AUTH_TOKEN"
organization = ""
bucket = "DATABASE_NAME"Replace the following:
DATABASE_NAME: the name of the database to write data toAUTH_TOKEN: your InfluxDB 3 Core token
For InfluxDB 3 Core, set the following v2-specific options:
organization: set to an empty string ("").bucket: the name of the database to write data to.
An InfluxDB v2 bucket is synonymous with an InfluxDB 3 Core database.
Use the InfluxDB v1 output plugin
If you bring an existing InfluxDB v1 write workload, use the
influxdb output plugin
to write to InfluxDB 3 Core through the InfluxDB
v1 compatibility API.
[[outputs.influxdb]]
urls = ["http://localhost:8181"]
database = "DATABASE_NAME"
skip_database_creation = true
username = "ignored"
password = "AUTH_TOKEN"Replace the following:
DATABASE_NAME: the name of the database to write data toAUTH_TOKEN: your InfluxDB 3 Core token
For InfluxDB 3 Core, set the following v1-specific options:
skip_database_creation: set totrue. InfluxDB 3 Core doesn’t support creating databases through the v1 API.password: your authorization token. The v1 compatibility API authenticates with the token passed as the password credential and ignoresusername.
Other Telegraf configuration options
For more plugin configuration options, see the
influxdb_v3,
influxdb_v2, and
influxdb (v1) output plugin
references.
Start Telegraf
Start the Telegraf service using the --config flag to specify the location of
your telegraf.conf.
telegraf --config /path/to/custom/telegraf.confWas 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 InfluxDB 3 Core and this documentation. To find support, use the following resources:
Customers with an annual or support contract can contact InfluxData Support.