Kafka Connect Splunk Sink Connector¶
The Kafka Connect Splunk Sink Connector is used to move messages from Kafka to Splunk.
The connector has the following features:
- Data ingestion from Kafka topics into Splunk via Splunk HTTP Event Collector (HEC)
The Splunk HTTP Event Collector (HEC) receives data from Kafka topics via HTTP or HTTPS connection using an Event Collector token configured in Splunk.
- In-flight data transformation and enrichment.
This feature is used to enrich raw data with extra metadata fields. The configured enrichment metadata is indexed along with raw event data by the Splunk software. See Indexed Field Extractions for more information.
Data enrichment for
/eventHEC endpoint is only available in Splunk Enterprise 6.5 and above.
- Acknowledgement mode
This feature implements guaranteed delivery by polling Splunk for acknowledgement before committing the Kafka offset.
The following are required to run the Splunk Sink Connector:
- Kafka Broker: Confluent Platform 3.3.0 or above, or Kafka 0.11.0 or above
- Connect: Confluent Platform 4.0 or above, or Kafka 1.0 or above
- Java 1.8
- Splunk 6.5 or above, configured with valid HTTP Event Collector (HEC) tokens
- Splunk Indexers and Heavy Forwarders that send information to this connector should have the same HEC token settings as this connector.
- Task configuration parameters vary depending on acknowledgement setting. See the Configuration Properties for details.
HEC Acknowledgement prevents potential data loss but may slow down event ingestion.
Install Splunk Sink Connector¶
You can install this connector by using the Confluent Hub client (recommended) or you can manually download the ZIP file.
Install the connector using Confluent Hub¶
- Confluent Hub Client must be installed. This is installed by default with Confluent Enterprise.
Navigate to your Confluent Platform installation directory and run this command to install the latest (
latest) connector version.
The connector must be installed on every machine where Connect will be run.
confluent-hub install splunk/kafka-connect-splunk-sink:latest
You can install a specific version by replacing
latest with a version number. For example:
confluent-hub install splunk/kafka-connect-splunk-sink:1.1.1
The Splunk Sink connector is an open source connector and does not require a Confluent Enterprise License.
The default port used by a Splunk HEC is
8088. However, the KSQL component of Confluent Platform also uses that port. For this quick start, since both Splunk and Confluent Platform will be running, we configure the HEC to use port
8889. If that port is in use by another process, change
8889 to a different, open port.
Start a Splunk Enterprise instance by running the Splunk Docker container.
docker run -d -p 8000:8000 -p 8889:8889 -e "SPLUNK_START_ARGS=--accept-license" -e "SPLUNK_PASSWORD=password" --name splunk splunk/splunk:7.3.0
Open http://localhost:8000 to access Splunk Web. Login with username
Configure a Splunk HEC using Splunk Web.
- Click Settings > Data Inputs.
- Click HTTP Event Collector.
- Click Global Settings.
- In the All Tokens toggle button, select Enabled.
- Ensure SSL disabled is checked.
- Change the HTTP Port Number to 8889.
- Click Save.
- Click New Token.
- In the Name field, enter a name for the token:
- Click Next.
- Click Review.
- Click Submit.
Note the token value on the “Token has been created successfully” page. This token value is needed for the connector configuration later.
Install the connector through the Confluent Hub Client.
# run from your Confluent Platform installation directory confluent-hub install splunk/kafka-connect-splunk:latest
Start Confluent Platform.
The command syntax for the Confluent CLI development commands changed in 5.3.0. These commands have been moved to
confluent local. For example, the syntax for
confluent startis now
confluent local start. For more information, see confluent local.
confluent local start
Produce test data to the
splunk-qstopic in Kafka.
echo event 1 | confluent local produce splunk-qs echo event 2 | confluent local produce splunk-qs
splunk-sink.propertiesfile with the properties below. Substitute
<HEC_TOKEN>with the Splunk HEC token created earlier.
name=SplunkSink topics=splunk-qs tasks.max=1 connector.class=com.splunk.kafka.connect.SplunkSinkConnector splunk.indexes=main splunk.hec.uri=http://localhost:8889 splunk.hec.token=<HEC_TOKEN> splunk.sourcetypes=my_sourcetype confluent.topic.bootstrap.servers=localhost:9092 confluent.topic.replication.factor=1 value.converter=org.apache.kafka.connect.storage.StringConverter
Start the connector.
You must include a double dash (
--) between the topic name and your flag. For more information, see this post.
confluent local load splunk -- -d splunk-sink.properties
In the Splunk UI, verify that data is flowing into your Splunk platform instance by searching using the search parameter
Shut down Confluent Platform.
confluent local destroy
Shut down the Docker container.
docker stop splunk docker rm splunk