<a id="cc-influxdb2-source"></a>

# InfluxDB 2 Source Connector for Confluent Cloud

The fully managed InfluxDB 2 Source connector for Confluent Cloud imports data from an InfluxDB host into Apache Kafka® topics.

The connector loads data by periodically executing an InfluxDB query and creating
an output record for each row in the result set. By default, all measurements in
a database are copied, each to its own output topic. The connector monitors the
database for new measurements and adapts automatically. When copying data from a
measurement, the connector loads only new records.

#### NOTE
* This Quick Start is for the fully managed Confluent Cloud connector. If you are
  installing the connector locally for Confluent Platform, see [InfluxDB Source Connector for
  Confluent Platform](https://docs.confluent.io/kafka-connectors/influxdb/current/influx-db-source-connector/index.html).
* If you require private networking for fully managed connectors, make sure to set up the proper
  networking beforehand. For more information, see [Manage Networking for Confluent Cloud Connectors](networking/internet-resource.md#clusters-connect-cloud).

## Features

The InfluxDB 2 Source connector supports the following features:

* **At least once delivery**: This connector guarantees that records from the Kafka topic are delivered at least once.
* **Supports one task**: The connector supports running a single task, which is initiated when in QUERY mode. Otherwise, the connector initiates tasks based on the minimum number of measurements or max-tasks configured.
* **Offset management capabilities**: Supports offset management. For more information, see [Manage custom offsets](#cc-influxdb2-source-custom-offsets).

For more information and examples to use with the Confluent Cloud API for Connect,
see the [Confluent Cloud API for Connect Usage Examples](connect-api-section.md#ccloud-connect-api) section.

## Limitations

Be sure to review the following information.

* For connector limitations, see [InfluxDB Source Connector](limits.md#cc-influxdb2-source-limits) limitations.
* If you plan to use one or more Single Message Transformations (SMTs), see [SMT Limitations](single-message-transforms.md#cc-single-message-transforms-limitations).

<a id="cc-influxdb2-source-custom-offsets"></a>

## Manage custom offsets

You can manage the offsets for this connector. Offsets provide information on the
point in the system from which the connector is accessing data. For more
information, see [Manage Offsets for Fully Managed Connectors in Confluent Cloud](offsets.md#connect-custom-offsets).

**To manage offsets**:

- Manage offsets using Confluent Cloud APIs. For more information, see [Connect offsets API reference](https://docs.confluent.io/cloud/current/ccloud/offsets-connect-v-1/).

### Get the current offset

To get the current offset, make a `GET` request that specifies the environment, Kafka cluster, and connector name.

```bash
GET /connect/v1/environments/{environment_id}/clusters/{kafka_cluster_id}/connectors/{connector_name}/offsets
Host: https://api.confluent.cloud
```

**Response:**

Successful calls return HTTP `200` with a JSON payload that describes the offset.

```bash
{
    "id": "lcc-example123",
    "name": "{connector_name}",
    "offsets": [
       {
             "partition": {
                "measurement": "my-example"
             },
             "offset": {
                "time": "2024-02-26T12:25:28.595877Z"
             }
       }
    ],
    "metadata": {
        "observed_at": "2024-03-28T17:57:48.139635200Z"
    }
}
```

Responses include the following information:

- The position of latest offset.
- The observed time of the offset in the metadata portion of the payload. The `observed_at` time
  indicates a snapshot in time for when the API retrieved the offset. A running connector is always updating
  its offsets. Use `observed_at` to get a sense for the gap between real time and the time at which the request
  was made. By default, offsets are observed every minute. Calling `GET` repeatedly will fetch more recently
  observed offsets.
- Information about the connector.
- In these examples, the curly braces around “{connector_name}” indicate a replaceable value.

### Update the offset

To update the offset, make a `POST` request that specifies the environment, Kafka cluster, and connector
name. Include a JSON payload that specifies new offset and a patch type.

```bash
POST /connect/v1/environments/{environment_id}/clusters/{kafka_cluster_id}/connectors/{connector_name}/offsets/request
Host: https://api.confluent.cloud

 {
     "type": "PATCH",
     "offsets": [
     {
           "partition": {
              "measurement": "local-cloud-source-system-test"
           },
           "offset": {
              "time": "2024-02-26T12:25:28.595877Z"
           }
     }
   ]
 }
```

**Considerations:**

- You can only make one offset change at a time for a given connector.
- This is an asynchronous request. To check the status of this request, you must use the check offset status API. For more information,
  see **Get the status of an offset request**.
- For source connectors, the connector attempts to read from the position defined by the requested offsets.

**Response:**

Successful calls return HTTP `202 Accepted` with a JSON payload that describes the offset.

```bash
{
    "id": "lcc-example123",
    "name": "{connector_name}",
     "offsets": [
        {
              "partition": {
                 "measurement": "local-cloud-source-system-test"
              },
              "offset": {
                 "time": "2024-02-26T12:25:28.595877Z"
              }
        }
     ],
    "requested_at": "2024-02-26T12:18:45.606796307Z",
    "type": "PATCH"
}
```

Responses include the following information:

- The requested position of the offsets in the source.
- The time of the request to update the offset.
- Information about the connector.

### Delete the offset

To delete the offset, make a `POST` request that specifies the environment, Kafka cluster, and connector
name. Include a JSON payload that specifies the delete type.

```bash
 POST /connect/v1/environments/{environment_id}/clusters/{kafka_cluster_id}/connectors/{connector_name}/offsets/request
 Host: https://api.confluent.cloud

{
  "type": "DELETE"
}
```

**Considerations:**

- Delete requests delete the offset for the provided partition and reset to the base state. A
  delete request is as if you created a fresh new connector.
- This is an asynchronous request. To check the status of this request, you must use the check offset status API. For more information,
  see **Get the status of an offset request**.
- Do not issue delete and patch requests at the same time.
- For source connectors, the connector attempts to read from the position defined in the base state.

**Response**:

Successful calls return HTTP `202 Accepted` with a JSON payload that describes the result.

```bash
{
  "id": "lcc-example123",
  "name": "{connector_name}",
  "offsets": [],
  "requested_at": "2024-03-28T17:59:45.606796307Z",
  "type": "DELETE"
}
```

Responses include the following information:

- Empty offsets.
- The time of the request to delete the offset.
- Information about Kafka cluster and connector.
- The type of request.

### Get the status of an offset request

To get the status of a previous offset request, make a `GET` request that specifies the environment, Kafka cluster, and connector
name.

```bash
GET /connect/v1/environments/{environment_id}/clusters/{kafka_cluster_id}/connectors/{connector_name}/offsets/request/status
Host: https://api.confluent.cloud
```

**Considerations:**

- The status endpoint always shows the status of the most recent PATCH/DELETE operation.

**Response**:

Successful calls return HTTP `200` with a JSON payload that describes the result. The following is an example
of an applied patch.

```bash
{
   "request": {
      "id": "lcc-example123",
      "name": "{connector_name}",
      "offsets": [
            {
               "partition": {
                  "measurement": "local-cloud-source-system-test"
               },
               "offset": {
                  "time": "2024-03-28T17:59:45.606796307Z"
               }
            }
      ],
      "requested_at": "2024-03-28T17:58:45.606796307Z",
      "type": "PATCH"
   },
   "status": {
      "phase": "APPLIED",
      "message": "The Connect framework-managed offsets for this connector have been altered successfully. However, if this connector manages offsets externally, they will need to be manually altered in the system that the connector uses."
   },
   "previous_offsets": [
      {
            "partition": {
               "measurement": "local-cloud-source-system-test"
            },
            "offset": {
               "time": "2024-03-28T17:57:48.079141883Z"
            }
      }
   ],
   "applied_at": "2024-03-28T17:58:44.079141883Z"
}
```

Responses include the following information:

- The original request, including the time it was made.
- The status of the request: applied, pending, or failed.
- The time you issued the status request.
- The previous offsets. These are the offsets that the connector last updated
  prior to updating the offsets. Use these to try to restore the state of your connector
  if a patch update causes your connector to fail or to return a connector to its
  previous state after rolling back.

### JSON payload

The table below offers a description of the unique fields in the JSON payload for managing offsets of the InfluxDB 2 Source connector.
For more information about InfluxDB terminology, see
[InfluxDB Cloud Serverless documentation](https://docs.influxdata.com/influxdb/cloud-serverless/).

| Field         | Definition                                                                                                  | Required/Optional   |
|---------------|-------------------------------------------------------------------------------------------------------------|---------------------|
| `measurement` | A string that describes the data stored in associated fields of the data structure part of InfluxDB.        | Required            |
| `time`        | An InfluxDB data type that represents a single point in time with nanosecond precision. This is the offset. | Required            |

## Quick Start

Use this quick start to get up and running with the Confluent Cloud InfluxDB 2 Source
connector. The quick start provides the basics of selecting the connector and
configuring it to stream events to Apache Kafka®.

<a id="cc-influxdb2-source-prereqs"></a>

Prerequisites
: - Authorized access to a [Confluent Cloud](https://www.confluent.io/confluent-cloud/) cluster on Amazon Web Services (AWS), Microsoft Azure (Azure), or Google Cloud.
  - The Confluent CLI installed and configured for the cluster. See [Install the Confluent CLI](https://docs.confluent.io/confluent-cli/current/install.html).
  - Authorized access to query the InfluxDB bucket. For more information, see [Query data](https://docs.influxdata.com/influxdb/v2.1/api/#tag/Query).
  <br/>
    #### NOTE
    The connector requires `--read-bucket` permission for the bucket where it sends data. For more information, see [Query data](https://docs.influxdata.com/influxdb/v2.1/api/#tag/Query).
  - [Schema Registry](../get-started/schema-registry.md#cloud-sr-config) must be enabled to use a Schema Registry-based format (for example, Avro, JSON_SR (JSON Schema), or Protobuf).

### Using the Confluent Cloud Console

#### Step 1: Launch your Confluent Cloud cluster

To create and launch a Kafka cluster in Confluent Cloud, see [Create a kafka cluster in Confluent Cloud](../get-started/index.md#cloud-create-kafka-cluster).

#### Step 2: Add a connector

In the left navigation menu, click **Connectors**. If you already have connectors in your cluster, click **+ Add
connector**.

#### Step 3: Select your connector

Click the **InfluxDB 2 Source** connector card.

![InfluxDB 2 Source Connector Card](images/ccloud-influxdb2-source-icon.png)

<a id="cc-influx-db2-source-setup-connection"></a>

#### Step 4: Enter the connector details

#### NOTE
* Make sure you have all your [prerequisites](#cc-influxdb2-source-prereqs) completed.
* An asterisk ( \* ) designates a required entry.

At the **Add InfluxDB 2 Source Connector** screen, complete the following:

### Define a topic prefix

In the **Kafka Topic Name Prefix** field, define a topic prefix your
connector will use to publish to Kafka topics. The connector publishes Kafka
topics using the following naming convention:
`<topic.prefix><tableName>`.

### Kafka access

1. Select the way you want to provide **Kafka Cluster credentials**. You can
   choose one of the following options:
   - **My account**: This setting allows your connector to globally access everything
     that you have access to. With a user account, the connector uses an API key and
     secret to access the Kafka cluster. This option is not recommended for production.
   - **Service account**: This setting limits the access for your connector by using a
     [service account](service-account.md#s3-cloud-service-account). This option is recommended for
     production.
   - **Use an existing API key**: This setting allows you to specify an API key and a
     secret pair. You can use an existing pair or create a new one. This method is not
     recommended for production environments.

   #### NOTE
   Freight clusters support only service accounts for Kafka authentication.
2. Click **Continue**.

### Authentication

1. Configure the authentication properties:

   **InfluxDB**
   - **InfluxDB API URL**: Fully-qualified InfluxDB API URL used for
     establishing a connection. For example,
     `http://influxdb-test.com:8086`.
   - **InfluxDB Bucket**: The name of the bucket from which the connector
     queries data.
   - **InfluxDB Token**: Token to authenticate with the InfluxDB host.
   - **InfluxDB Organization ID**: The InfluxDB organization ID.
2. Click **Continue**.

### Configuration

**Output messages**

- **Select output record value format**: Select the output record value format (data going to the Kafka topic):
  AVRO, JSON, JSON_SR (JSON Schema), or PROTOBUF. [Schema Registry](../get-started/schema-registry.md#cloud-sr-config) must be enabled to use a Schema Registry-based format (for
  example, Avro, JSON Schema, or Protobuf).

**Read Configuration**

- **Mode**: The mode that the connector uses to poll measurements in
  InfluxDB. `bulk` performs a bulk load of the entire measurement to
  the Kafka topic each time the connector polls InfluxDB. `timestamp`
  uses the timestamp to detect newly created rows and writes these to
  the Kafka topic.
- **Topic Mapper**: Determines how to map topics. `bucket` maps to a
  topic name using the *topic prefix + bucket name*. All records go
  into the same topic. `measurement` maps to a topic name using the
  **topic prefix + measurement name**. All the records from the same
  measurement go into the same topic.

### **Show advanced configurations**

- **Schema context**: Select a schema context to use for this connector, if using
  a schema-based data format. This property defaults to the **Default** context,
  which configures the connector to use the default schema set up for Schema Registry in your
  Confluent Cloud environment. A schema context allows you to use separate schemas (like
  schema sub-registries) tied to topics in different Kafka clusters that share the
  same Schema Registry environment. For example, if you select a non-default context, a
  **Source** connector uses only that schema context to register a schema and a
  **Sink** connector uses only that schema context to read from. For more
  information about setting up a schema context, see [What are schema contexts and when should you use them?](../sr/faqs-cc.md#faq-schema-contexts).

**Auto-restart policy**

- **Enable Connector Auto-restart**: Enables the auto-restart behavior of the connector and its
  task in the event of user-actionable errors. Defaults to `true`, enabling the connector to
  automatically restart in case of user-actionable errors. Set this property to `false` to
  disable auto-restart for failed connectors. If disabled, you must manually restart the connector.

**Additional Configs**

- **Value Converter Decimal Format**: Specifies the `JSON` or `JSON_SR` serialization format for Connect `DECIMAL` logical type values with two allowed literals:
  `BASE64` to serialize `DECIMAL` logical types as base64 encoded binary data, and
  `NUMERIC` to serialize `DECIMAL` logical type values in `JSON` or `JSON_SR` as a number representing the decimal value.
- **Key Converter Schema ID Serializer**: The class name of the schema ID serializer for keys. This is used to serialize schema IDs in the message headers.
- **Value Converter Reference Subject Name Strategy**: Sets the subject reference name strategy for values. Valid entries are `DefaultReferenceSubjectNameStrategy` or `QualifiedReferenceSubjectNameStrategy`. You can use this strategy only with `PROTOBUF` format; the default strategy is `DefaultReferenceSubjectNameStrategy`.
- **Value Converter Connect Meta Data**: Enables the Connect converter to add its metadata to the output schema. Applies to Avro converters.
- **Value Converter Value Subject Name Strategy**: Determines how to construct the subject name under which the value schema is registered with Schema Registry.
- **Key Converter Key Subject Name Strategy**: Determines how to construct the subject name for key schema registration.
- **Value Converter Schema ID Serializer**: The class name of the schema ID serializer for values. This is used to serialize schema IDs in the message headers.

**Retries**

- **Backoff Time**: Backoff time duration to wait before retrying.
  Defaults to 1000 milliseconds.
- **Max retries**: The maximum number of times to retry on errors before failing the task.

**Read Configuration**

- **Flux Query**: If specified, this query will be executed and the
  resultant records will be pushed to desired Apache Kafka topic.
  Use this setting if there’s a need to select subset of fields or
  tags, perform aggregations or filter data.
- **Max Points Per Batch**: The maximum number of points to include
  in a single batch when polling for new data. This setting can be
  used to limit the amount of data buffered internally in the
  connector.
- **Delay Interval (ms)**: How long to wait after a record with a
  timestamp appears before the connector includes it in the result. Add
  a delay to allow transactions with earlier
  timestamps to complete. The first execution fetches all
  available records (that is, starting at Unix Epoch) until the current
  time, minus this delay. Every following execution gets data from
  the time of the last record fetched in the previous batch until
  the current time, minus this delay.
- **Measurements Included**: A comma-separated list of measurements
  to include. If specified, the Measurements Excluded
  (`influxdb.measurement.blacklist`) cannot be set. If left empty,
  all measurements are included.
- **Measurements Excluded**: A comma-separated list of measurements
  to exclude. If specified, the Measurements Included
  (`influxdb.measurement.whitelist`) cannot be set.

**Transforms**

- **Single Message Transformations**: To add a new SMT, see [Add transforms](single-message-transforms.md#cc-single-message-transforms-ui).
  For more information about unsupported SMTs, see
  [Unsupported transformations](single-message-transforms.md#cc-single-message-transforms-unsupported-transforms).

**Processing position**

- **Set offsets**: Click **Set offsets** to define a specific offset for
  this connector to begin procession data from. For more information
  on managing offsets, see [Manage offsets](offsets.md#connect-custom-offsets).

For all property and value definitions, see
[Configuration Properties](#cc-influxdb2-source-config-properties).

- Click **Continue**.

### Sizing

Based on the number of topic partitions you select, you will be provided
with a recommended number of tasks.

1. To change the number of tasks, use the Range Slider to select the
   desired number of tasks.
2. Click **Continue**.

### Review and Launch

1. Verify the connection details by previewing the running configuration.
2. After you’ve validated that the properties are configured to your
   satisfaction, click **Launch**.

   The status for the connector should go from **Provisioning** to
   **Running**.

#### Step 5: Check for files

Verify that data is being produced at the InfluxDB host.

For more information and examples to use with the Confluent Cloud API for Connect,
see the [Confluent Cloud API for Connect Usage Examples](connect-api-section.md#ccloud-connect-api) section.

### Using the Confluent CLI

To set up and run the connector using the Confluent CLI, complete the
following steps.

#### NOTE
Make sure you have all your [prerequisites](#cc-influxdb2-source-prereqs) completed.

#### Step 1: List the available connectors

Enter the following command to list available connectors:

```none
confluent connect plugin list
```

#### Step 2: List the connector configuration properties

Enter the following command to show the connector configuration properties:

```none
confluent connect plugin describe <connector-plugin-name>
```

The command output shows the required and optional configuration properties.

#### Step 3: Create the connector configuration file

Create a JSON file that contains the connector configuration properties. The
following example shows the required connector properties.

```json
{
  "connector.class": "InfluxDB2Source",
  "name": "InfluxDB2Source_0",
  "kafka.api.key": "****************",
  "kafka.api.secret": "*********************************",
  "influxdb.url": "http://influxdb-test.com:8086",
  "influxdb.token": "***************************",
  "influxdb.org.id": "<organization-id>",
  "influxdb.bucket": "<bucket-name>",
  "topic.prefix": "<topic-prefix>",
  "output.data.format": "JSON",
  "tasks.max": "1",
}
```

Note the following property definitions:

* `"connector.class"`: Identifies the connector plugin name.
* `"name"`: Sets a name for your new connector.

* `"kafka.auth.mode"`: Identifies the connector authentication mode you want to use. There are two options: `SERVICE_ACCOUNT` or `KAFKA_API_KEY` (the default). To use an API key and secret, specify the configuration properties `kafka.api.key` and `kafka.api.secret`, as shown in the example configuration (above).  To use a [service account](service-account.md#s3-cloud-service-account), specify the **Resource ID** in the property `kafka.service.account.id=<service-account-resource-ID>`. To list the available service account resource IDs, use the following command:
  ```bash
  confluent iam service-account list
  ```

  For example:
  ```bash
  confluent iam service-account list

     Id     | Resource ID |       Name        |    Description
  +---------+-------------+-------------------+-------------------
     123456 | sa-l1r23m   | sa-1              | Service account 1
     789101 | sa-l4d56p   | sa-2              | Service account 2
  ```

* `"influxdb.url"`: Fully-qualified InfluxDB API URL used for establishing a connection. For example, `http://influxdb-test.com:8086`
* `"influxdb.token"`: Token to authenticate with the InfluxDB host.
* `"influxdb.org.id"`: The InfluxDB organization ID.

  #### NOTE
  The connector requires `--read-bucket` permission for the bucket where it sends data. For more information, see [Query data](https://docs.influxdata.com/influxdb/v2.1/api/#tag/Query).

  For more information, see [writing data to InfluxDB](https://docs.influxdata.com/influxdb/v2.1/api/#operation/PostWrite).
* `"influxdb.bucket"`: The bucket where the connector sends data.
* `"output.data.format"`: Supported formats are AVRO, PROTOBUF, JSON_SR (JSON Schema), or JSON (schemaless). A valid schema must be available in [Schema Registry](../get-started/schema-registry.md#cloud-sr-config) to use a schema-based message format (for example, Avro, JSON_SR (JSON Schema), or Protobuf).
* `"tasks.max"`: Enter the number of [tasks](/platform/current/connect/concepts.html#tasks) to use with the connector. The connector supports running a single task, which is initiated when in QUERY mode. Otherwise, the connector initiates tasks based on the minimum number of measurements or max-tasks configured.

**SMTs**: For details about adding SMTs using the Confluent CLI, see the [Single Message Transformations](single-message-transforms.md#cc-single-message-transforms) documentation.

See [Configuration Properties](#cc-influxdb2-source-config-properties) for all property values and
descriptions.

#### Step 3: Load the properties file and create the connector

Enter the following command to load the configuration and start the connector:

```none
confluent connect cluster create --config-file <file-name>.json
```

For example:

```none
confluent connect cluster create --config-file influxdb2-source-config.json
```

Example output:

```none
Created connector InfluxDB2Source_0 lcc-do6vzd
```

#### Step 4: Check the connector status.

Enter the following command to check the connector status:

```none
confluent connect cluster list
```

Example output:

```none
ID           |             Name        | Status  | Type   | Trace
+------------+-------------------------+---------+--------+-------+
lcc-do6vzd   | InfluxDB2Source_0       | RUNNING | Source |       |
```

#### Step 5: Check for files

Verify that data is being produced at the Kafka topic.

For more information and examples to use with the Confluent Cloud API for Connect,
see the [Confluent Cloud API for Connect Usage Examples](connect-api-section.md#ccloud-connect-api) section.

<a id="cc-influxdb2-source-config-properties"></a>

## Configuration Properties

Use the following configuration properties with the fully managed connector. For
self-managed connector property definitions and other details, see the connector
docs in [Self-managed connectors for Confluent Platform](/platform/current/connect/kafka_connectors.html).

### How should we connect to your data?

`name`
: Sets a name for your connector.
  <br/>
  * Type: string
  * Valid Values: A string at most 64 characters long
  * Importance: high

### Schema Config

`schema.context.name`
: Add a schema context name. A schema context represents an independent scope in Schema Registry. It is a separate sub-schema tied to topics in different Kafka clusters that share the same Schema Registry instance. If not used, the connector uses the default schema configured for Schema Registry in your Confluent Cloud environment.
  <br/>
  * Type: string
  * Default: default
  * Importance: medium

### Kafka Cluster credentials

`kafka.auth.mode`
: Kafka Authentication mode. It can be one of KAFKA_API_KEY or SERVICE_ACCOUNT. It defaults to KAFKA_API_KEY mode, whenever possible.
  <br/>
  * Type: string
  * Valid Values: SERVICE_ACCOUNT, KAFKA_API_KEY
  * Importance: high

`kafka.api.key`
: Kafka API Key. Required when kafka.auth.mode==KAFKA_API_KEY.
  <br/>
  * Type: password
  * Importance: high

`kafka.service.account.id`
: The Service Account that will be used to generate the API keys to communicate with Kafka Cluster.
  <br/>
  * Type: string
  * Importance: high

`kafka.api.secret`
: Secret associated with Kafka API key. Required when kafka.auth.mode==KAFKA_API_KEY.
  <br/>
  * Type: password
  * Importance: high

### InfluxDB

`influxdb.url`
: Fully qualified InfluxDB API URL used for establishing connection.
  <br/>
  * Type: string
  * Importance: high

`influxdb.token`
: Token to authenticate with influx db.
  <br/>
  * Type: password
  * Importance: high

`influxdb.org.id`
: Organization ID.
  <br/>
  * Type: string
  * Importance: high

`influxdb.bucket`
: Bucket from which this connector will read the data from.
  <br/>
  * Type: string
  * Importance: medium

### Read Configuration

`query`
: If specified, this query will be executed and the resultant records will be pushed to desired Apache Kafka topic. Use this setting if there’s a need to select subset of fields or tags, perform aggregations or filter data. The query should follow the template - `import "influxdata/influxdb/schema" from(bucket:$influxdb.bucket) |> range(start: $startTimestamp, stop: $endTimestamp) |> <Your custom query criteria here> |> schema.fieldsAsCols() |> limit(n: $batch.size)` In case of `mode=bulk`, the connector will run the query as-is each time it polls. The range criteria should be filled in by the user. Flux does not allow unbounded queries as they are resource intensive. If you use `mode=timestamp`, the values for `$startTimestamp` and `$endTimestamp` will be filled by the connector with appropriate source offsets.Users should replace other criteria mentioned at - `<Your custom query criteria here>`. The connector will replace `$influxdb.bucket` and `$batch.size` with the values from the corresponding configurations.
  <br/>
  * Type: string
  * Importance: medium

`mode`
: The mode in which measurements in InfluxDB has to be polled. Supported modes are : bulk performs a bulk load of the entire measurement to desired Apache Kafka topic, each time it is polled. timestamp uses the timestamp to detect newly created rows and writes them to desired Apache Kafka topic.
  <br/>
  * Type: string
  * Default: timestamp
  * Importance: medium

`topic.mapper`
: Configuration to decide how to map topics Supported options are : bucket - Topic name is Topic Prefix + Bucket name. All the records go into same topic. Or measurement - Topic name is Topic Prefix + Measurement name. All the records from same measurement go into same topic.
  <br/>
  * Type: string
  * Default: bucket
  * Importance: medium

`topic.prefix`
: Prefix that should be prepended to measurement names to determine the name of the Apache Kafka topic to publish data to, in case of custom query, it should be the full name of the Apache Kafka topic.
  <br/>
  * Type: string
  * Importance: medium

`batch.size`
: Maximum number of points to include in a single batch when polling for new data. This setting can be used to limit the amount of data buffered internally in the connector.
  <br/>
  * Type: int
  * Default: 5000
  * Importance: medium

`timestamp.delay.interval.ms`
: How long to wait after a record with certain timestamp appears before we include it in the result. You may choose to add some delay to allow transactions with earlier timestamp to complete. The first execution will fetch all available records (i.e. starting at Unix Epoch) until current time minus the delay. Every following execution will get data from the time of the last record fetched in the previous batch until current time minus the delay.
  <br/>
  * Type: int
  * Default: 0
  * Importance: medium

`influxdb.measurement.whitelist`
: Comma separated list of measurements to include in copying. If specified, Measurements Excluded cannot be set. If left empty, all measurements will be included.
  <br/>
  * Type: string
  * Importance: medium

`influxdb.measurement.blacklist`
: Comma separated list of measurements to exclude from copying. If specified, Measurements Included cannot be set.
  <br/>
  * Type: string
  * Importance: medium

### Retries

`retry.backoff.ms`
: Backoff time duration to wait before retrying
  <br/>
  * Type: int
  * Default: 1000 (1 second)
  * Importance: medium

`max.retries`
: The maximum number of times to retry on errors before failing the task.
  <br/>
  * Type: int
  * Default: 10
  * Importance: medium

### Output messages

`output.data.format`
: Sets the output Kafka record value format. Valid entries are AVRO, JSON_SR, PROTOBUF, or JSON. Note that you need to have Confluent Cloud Schema Registry configured if using a schema-based message format like AVRO, JSON_SR, and PROTOBUF
  <br/>
  * Type: string
  * Default: JSON
  * Importance: high

### Number of tasks for this connector

`tasks.max`
: Maximum number of tasks for the connector.
  <br/>
  * Type: int
  * Valid Values: [1,…]
  * Importance: high

### Auto-restart policy

`auto.restart.on.user.error`
: Enable connector to automatically restart on user-actionable errors.
  <br/>
  * Type: boolean
  * Default: true
  * Importance: medium

### Additional Configs

`header.converter`
: The converter class for the headers. This is used to serialize and deserialize the headers of the messages.
  <br/>
  * Type: string
  * Importance: low

`producer.override.compression.type`
: The compression type for all data generated by the producer. Valid values are none, gzip, snappy, lz4, and zstd.
  <br/>
  * Type: string
  * Importance: low

`value.converter.allow.optional.map.keys`
: Allow optional string map key when converting from Connect Schema to Avro Schema. Applicable for Avro Converters.
  <br/>
  * Type: boolean
  * Importance: low

`value.converter.auto.register.schemas`
: Specify if the Serializer should attempt to register the Schema.
  <br/>
  * Type: boolean
  * Importance: low

`value.converter.connect.meta.data`
: Allow the Connect converter to add its metadata to the output schema. Applicable for Avro Converters.
  <br/>
  * Type: boolean
  * Importance: low

`value.converter.enhanced.avro.schema.support`
: Enable enhanced schema support to preserve package information and Enums. Applicable for Avro Converters.
  <br/>
  * Type: boolean
  * Importance: low

`value.converter.enhanced.protobuf.schema.support`
: Enable enhanced schema support to preserve package information. Applicable for Protobuf Converters.
  <br/>
  * Type: boolean
  * Importance: low

`value.converter.flatten.unions`
: Whether to flatten unions (oneofs). Applicable for Protobuf Converters.
  <br/>
  * Type: boolean
  * Importance: low

`value.converter.generate.index.for.unions`
: Whether to generate an index suffix for unions. Applicable for Protobuf Converters.
  <br/>
  * Type: boolean
  * Importance: low

`value.converter.generate.struct.for.nulls`
: Whether to generate a struct variable for null values. Applicable for Protobuf Converters.
  <br/>
  * Type: boolean
  * Importance: low

`value.converter.int.for.enums`
: Whether to represent enums as integers. Applicable for Protobuf Converters.
  <br/>
  * Type: boolean
  * Importance: low

`value.converter.latest.compatibility.strict`
: Verify latest subject version is backward compatible when use.latest.version is true.
  <br/>
  * Type: boolean
  * Importance: low

`value.converter.object.additional.properties`
: Whether to allow additional properties for object schemas. Applicable for JSON_SR Converters.
  <br/>
  * Type: boolean
  * Importance: low

`value.converter.optional.for.nullables`
: Whether nullable fields should be specified with an optional label. Applicable for Protobuf Converters.
  <br/>
  * Type: boolean
  * Importance: low

`value.converter.optional.for.proto2`
: Whether proto2 optionals are supported. Applicable for Protobuf Converters.
  <br/>
  * Type: boolean
  * Importance: low

`value.converter.use.latest.version`
: Use latest version of schema in subject for serialization when auto.register.schemas is false.
  <br/>
  * Type: boolean
  * Importance: low

`value.converter.use.optional.for.nonrequired`
: Whether to set non-required properties to be optional. Applicable for JSON_SR Converters.
  <br/>
  * Type: boolean
  * Importance: low

`value.converter.wrapper.for.nullables`
: Whether nullable fields should use primitive wrapper messages. Applicable for Protobuf Converters.
  <br/>
  * Type: boolean
  * Importance: low

`value.converter.wrapper.for.raw.primitives`
: Whether a wrapper message should be interpreted as a raw primitive at root level. Applicable for Protobuf Converters.
  <br/>
  * Type: boolean
  * Importance: low

`key.converter.key.schema.id.serializer`
: The class name of the schema ID serializer for keys. This is used to serialize schema IDs in the message headers.
  <br/>
  * Type: string
  * Default: io.confluent.kafka.serializers.schema.id.PrefixSchemaIdSerializer
  * Importance: low

`key.converter.key.subject.name.strategy`
: How to construct the subject name for key schema registration.
  <br/>
  * Type: string
  * Default: TopicNameStrategy
  * Importance: low

`value.converter.decimal.format`
: Specify the JSON/JSON_SR serialization format for Connect DECIMAL logical type values with two allowed literals:
  <br/>
  BASE64 to serialize DECIMAL logical types as base64 encoded binary data and
  <br/>
  NUMERIC to serialize Connect DECIMAL logical type values in JSON/JSON_SR as a number representing the decimal value.
  <br/>
  * Type: string
  * Default: BASE64
  * Importance: low

`value.converter.flatten.singleton.unions`
: Whether to flatten singleton unions. Applicable for Avro and JSON_SR Converters.
  <br/>
  * Type: boolean
  * Default: false
  * Importance: low

`value.converter.reference.subject.name.strategy`
: Set the subject reference name strategy for value. Valid entries are DefaultReferenceSubjectNameStrategy or QualifiedReferenceSubjectNameStrategy. Note that the subject reference name strategy can be selected only for PROTOBUF format with the default strategy being DefaultReferenceSubjectNameStrategy.
  <br/>
  * Type: string
  * Default: DefaultReferenceSubjectNameStrategy
  * Importance: low

`value.converter.value.schema.id.serializer`
: The class name of the schema ID serializer for values. This is used to serialize schema IDs in the message headers.
  <br/>
  * Type: string
  * Default: io.confluent.kafka.serializers.schema.id.PrefixSchemaIdSerializer
  * Importance: low

`value.converter.value.subject.name.strategy`
: Determines how to construct the subject name under which the value schema is registered with Schema Registry.
  <br/>
  * Type: string
  * Default: TopicNameStrategy
  * Importance: low

## FAQs

Find answers to frequently asked questions about the InfluxDB 2 Source connector
for Confluent Cloud.

### What is the difference between timestamp mode and bulk mode?

The connector supports two data ingestion modes:

* **Timestamp mode**: The connector tracks the timestamp of the last record read
  and only fetches new records that have a timestamp after the stored offset. Use
  this mode for incremental data ingestion where you want to capture only new or
  updated data since the last poll.
* **Bulk mode**: The connector loads all data from the InfluxDB bucket on every
  poll cycle, starting from `1970-01-01`. Use this mode when you need a full
  snapshot of the data each time.

In both modes, you can use either a measurement-based query (where the connector
automatically discovers and reads from measurements) or a custom Flux query.

### How do you choose between the measurement and bucket topic mapper strategies?

The `topic.mapper` property controls how the connector names Kafka topics:

* **bucket** (default): Reads all data from the configured source bucket and
  produces it to a single topic using the naming convention
  `<topic.prefix><bucketName>`. Use this strategy when you want to consolidate
  all measurements into one topic.
* **measurement**: Creates a separate topic for each InfluxDB measurement using
  the naming convention `<topic.prefix><measurementName>`. Use this strategy
  when you want to logically separate data by measurement.

### What permissions does the InfluxDB API token require?

The InfluxDB API token must have `read` permission for the source bucket that
the connector reads from. When creating a token in InfluxDB, grant it
`--read-bucket` permission for that specific bucket. Without these read
permissions, the connector fails during validation with an authentication error.

For more information, see [InfluxDB API Tokens](https://docs.influxdata.com/influxdb/v2.1/security/tokens/).

### Why is the connector producing duplicate records after a restart?

If you see duplicate records after a connector restart, this is typically caused by
the at-least-once delivery semantics of the connector. The connector stores the
timestamp of the last read record as its offset. Upon restart, it resumes reading
from the last committed offset, which might include some records that were already
produced before the restart.

To minimize duplicates:

* Ensure your downstream consumers are idempotent and can handle duplicate
  records.
* Consider using the `timestamp.delay.interval.ms` property to add a delay
  before reading the most recent data. This gives InfluxDB time to fully commit
  data before the connector reads it.

### Can you use a custom Flux query to filter data from InfluxDB?

Yes. Set the `"mode"` configuration property to either `timestamp` or `bulk`
and provide a custom Flux query in the connector configuration. The custom query
lets you filter, transform, or join data before it is published to Kafka.

When using a custom query in **timestamp mode**, the connector replaces the
`$startTimestamp` and `$endTimestamp` placeholder tokens in your query with the
stored offset timestamp and the current time respectively, so only new data is
fetched on each poll. The custom query must include these placeholders in the
`range()` function (for example, `range(start: $startTimestamp, stop: $endTimestamp)`).

When using a custom query in bulk mode, the `$startTimestamp` and
`$endTimestamp` placeholders are not replaced. You must provide a complete,
self-contained time range in your query without these placeholders.

In both modes, the `$influxdb.bucket` and `$batch.size` placeholders are
always replaced with the configured bucket name and batch size.

### Why does the connector fail with an authentication or connection error?

Authentication or connection errors usually indicate one of the following issues:

* **Incorrect InfluxDB URL**: Verify that the `influxdb.url` property contains the
  correct, fully-qualified URL for your InfluxDB instance (for example,
  `https://us-east-1-1.aws.cloud2.influxdata.com`).
* **Invalid or expired API token**: Ensure the `influxdb.token` value is a
  valid token with read access to the configured bucket. InfluxDB tokens can
  expire or be revoked from the InfluxDB UI.
* **Wrong organization ID**: Confirm the `influxdb.org.id` matches the
  organization in your InfluxDB instance. You can find this under
  **Settings > Organization** in the InfluxDB Cloud UI.
* **Network connectivity**: For fully managed connectors on Confluent Cloud, ensure that
  the InfluxDB endpoint is accessible from the internet or through a configured
  private networking option. Check firewall rules and security groups to allow
  inbound connections from Confluent Cloud egress IP ranges.

### How many tasks can the connector run?

The connector supports running a single task when configured in `QUERY` mode
(custom Flux query). When using measurement-based mode (no custom query), the
connector can run multiple tasks based on the minimum of the number of discovered
measurements or the `tasks.max` value.

### What output data formats does the connector support?

The connector supports the following `output.data.format` values:

* `AVRO` (Avro)
* `JSON_SR` (JSON Schema)
* `PROTOBUF` (Protobuf)
* `JSON` (schemaless JSON)

To use a schema-based format (`AVRO`, `JSON_SR`, or `PROTOBUF`), you must have
[Schema Registry](../get-started/schema-registry.md#cloud-sr-config) enabled in your Confluent Cloud environment.

### How do you control which measurements the connector reads?

You can control which measurements the connector reads using measurement
include and exclude lists:

* Use the `influxdb.measurement.whitelist` property to specify only the
  measurements you want the connector to read.
* Use the `influxdb.measurement.blacklist` property to exclude specific
  measurements.

Alternatively, use a custom Flux query to precisely define which data the
connector reads from InfluxDB.

## Next Steps

For an example that shows fully managed Confluent Cloud connectors in action with
Confluent Cloud for Apache Flink, see the [Cloud ETL Demo](/platform/current/tutorials/examples/cloud-etl/docs/index.html).
This example also shows how to use Confluent CLI to manage your resources in
Confluent Cloud.

[![image](images/topology.png)](https://docs.confluent.io/platform/current/tutorials/examples/cloud-etl/docs/index.html)
