---
title: Manually configure Telegraf
description: Update existing or create new Telegraf configurations to use the influxdb_v2 output plugin to write to InfluxDB. Start Telegraf using the custom configuration.
url: https://docs.influxdata.com/influxdb/v2/write-data/no-code/use-telegraf/manual-config/
estimated_tokens: 2476
product: InfluxDB OSS v2
version: v2
---

# Manually configure Telegraf

This page documents an earlier version of InfluxDB OSS. [InfluxDB 3 Core](/influxdb3/core/) is the latest stable version.

#### API token hashing is enabled by default in InfluxDB OSS 2.9.0

Stronger token security: tokens are stored as hashes on disk, so a copy of the database file doesn’t expose usable tokens. Existing tokens are hashed on first startup and the original strings can’t be recovered afterward — **capture any plaintext tokens you still need before you upgrade**.

For more information, see [Token hashing](/influxdb/v2/admin/tokens/#token-hashing).

Use the Telegraf `influxdb_v2` output plugin to collect and write metrics into an InfluxDB 2.9 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](/influxdb/v2/write-data/no-code/use-telegraf#requirements) for using Telegraf with InfluxDB 2.9.*

## 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](/telegraf/v1/plugins//) for a complete list of available plugins.*

### Manually add Telegraf plugins

To manually add any of the available [Telegraf plugins](/telegraf/v1/plugins//), follow the steps below.

1. Find the plugin you want to enable from the complete list of available [Telegraf plugins](/telegraf/v1/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](https://github.com/influxdata/telegraf/blob/release-1.14/plugins/inputs/mqtt_consumer/README.md).
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.9 instance, enable in the [`influxdb_v2` output plugin](https://github.com/influxdata/telegraf/blob/master/plugins/outputs/influxdb_v2/README.md) 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**.
    
    Load Data
    
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:

##### urls

An array of URLs for your InfluxDB 2.9 instances. See [InfluxDB URLs](/influxdb/v2/reference/urls/) for information about which URLs to use. **InfluxDB Cloud requires HTTPS**.

##### token

Your InfluxDB 2.9 API token. For information about viewing tokens, see [View tokens](/influxdb/v2/admin/tokens/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.

<!-- Tabbed content: Select one of the following options -->

**macOS or Linux:**

```sh
export INFLUX_TOKEN=YourAuthenticationToken
```

**Windows:**

<!-- Tabbed content: Select one of the following options -->

**PowerShell:**

```sh
$env:INFLUX_TOKEN = "YourAuthenticationToken"
```

**CMD:**

```sh
set INFLUX_TOKEN=YourAuthenticationToken
# Make sure to include a space character at the end of this command.
```

<!-- End tabbed content -->

<!-- End tabbed content -->

*See the [example `telegraf.conf` below](#example-influxdb_v2-configuration).*

##### organization

The name of the organization that owns the target bucket.

##### bucket

The name of the bucket to write data to.

#### Example influxdb\_v2 configuration

The example below illustrates an `influxdb_v2` configuration.

```toml
# ...

[[outputs.influxdb_v2]]
  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.9 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`](/influxdb/v2/reference/cli/influx/telegrafs/create/) or [`influx telegrafs update`](/influxdb/v2/reference/cli/influx/telegrafs/update/) commands. For more information, see:

-   [Create a Telegraf configuration](/influxdb/v2/tools/telegraf-configs/create/#use-the-influx-cli)
-   [Update a Telegraf configuration](/influxdb/v2/tools/telegraf-configs/update/#use-the-influx-cli)

## Start Telegraf

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

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

#### Related

-   [Plugin directory](/telegraf/v1/plugins/)
-   [Create a Telegraf configuration](/influxdb/v2/tools/telegraf-configs/create/)
-   [Update a Telegraf configuration](/influxdb/v2/tools/telegraf-configs/update/)

[manually](/influxdb/v2/tags/manually/) [plugin](/influxdb/v2/tags/plugin/) [mqtt](/influxdb/v2/tags/mqtt/)
