Splunk Integration
How to integrate Splunk with Connectware, including setting up an HTTP Event Collector token, streaming shop floor events into a Splunk index, and adding the equipment hierarchy as indexed fields.
This guide describes how to stream shop floor events from Connectware into Splunk through the HTTP Event Collector (HEC). You configure a service commissioning file that subscribes to machine events on the MQTT broker, wraps each event in the HEC JSON envelope, and sends it to a Splunk index. A complete example file is available at the end of this guide.
Objectives
Setting up an HTTP Event Collector token in Splunk.
Connecting Connectware to Splunk HEC with token authentication.
Streaming machine events from an ISA-95-style MQTT topic hierarchy into a Splunk index.
Adding the equipment hierarchy as indexed fields, so events are searchable by site, area, line, and cell.
Prerequisites
To follow this guide, you will need the following:
A running instance of Cybus Connectware.
A running Splunk instance: Splunk Enterprise or Splunk Cloud Platform, with permissions to create an HTTP Event Collector token.
Access to the Admin UI with sufficient user permissions.
Basic knowledge of MQTT and the Connectware services concept (for example, service commissioning files, connections, and endpoints).
Connectware and Splunk Integration
Splunk ingests data over HTTP through the HTTP Event Collector, a token-authenticated receiver for JSON events. Connectware communicates with HEC through the HTTP/REST connector. Every event is sent as a POST request to the /services/collector/event endpoint, wrapped in a JSON envelope that carries the event payload and its metadata, such as the target index, the source type, and the event time. The Authorization: Splunk <token> header authenticates each request.
The HEC address depends on your Splunk deployment:
Splunk Enterprise: HEC listens on TCP port
8088of your Splunk server, with TLS enabled by default.Splunk Cloud Platform: HEC is reachable on port
443under a dedicated hostname. On AWS deployments, the pattern ishttp-inputs-<host>.splunkcloud.com. On Google Cloud, Azure, and AWS GovCloud deployments, the pattern ishttp-inputs.<host>.splunkcloud.com, where<host>is the name of your Splunk Cloud Platform instance.
The MQTT topics in this guide follow an ISA-95-style equipment hierarchy (<enterprise>/<site>/<area>/<line>/<cell>). The mapping subscribes with wildcards across all levels, so any machine in the hierarchy is picked up without changing the integration. The wildcard values also end up as indexed fields on every event, which keeps the equipment context searchable in Splunk.
Setting Up the HTTP Event Collector
HEC is disabled by default on Splunk Enterprise. To enable it and create a token:
In Splunk Web, open Settings > Data Inputs > HTTP Event Collector.
Click Global Settings, set All Tokens to Enabled, and click Save. This dialog also shows the HEC port (default:
8088) and whether SSL is enabled.Click New Token and follow the wizard. Give the token a name and select the allowed indexes and the default index.
Copy the token value. You need it when you install the service.
On Splunk Cloud Platform, you do not manage global HEC settings. Create the token in the same menu and use the dedicated HEC hostname of your deployment.
Splunk Connection Properties
The connection to Splunk requires the HEC address and the token. We add them as parameters to the service commissioning file, so you can set them when you install the service.
Do not worry about copying the service commissioning file snippets together into one, the complete example file is available at the end of this guide.
splunkHost: The hostname of your Splunk instance, without the scheme. For Splunk Cloud Platform, use the dedicated HEC hostname, for examplehttp-inputs-example.splunkcloud.com.splunkPort: The HEC port. Defaults to8088for Splunk Enterprise. Use443for Splunk Cloud Platform.hecToken: The HEC token that authenticates event submissions.splunkIndex: The Splunk index that receives the events. The index must be in the allowed indexes of the token.topicRoot: The root of the MQTT topic hierarchy. Defaults toenterprise.
Splunk Connection
To connect to HEC, we set up a Cybus::Connection resource that uses the HTTP/REST connector. The headers property adds the Authorization: Splunk header to every request, so the endpoints that use this connection do not need any authentication configuration of their own.
The connection probes the /services/collector/health path, which responds without authentication when HEC is enabled and ready to accept events. A connected state therefore confirms the host, the port, and the TLS setup, but not the token.
On Splunk Enterprise, HEC uses a self-signed certificate by default. Connectware cannot validate this certificate, so the connection does not reach the connected state. Either configure HEC with a certificate from your own certificate authority (CA) and add the CA certificate as Base64-encoded PEM content in the caCert property of the connection, or set trustAllCertificates: true to accept any certificate. Use trustAllCertificates only in test environments because it disables server identity verification.
Streaming Machine Events into Splunk
HEC creates one event per JSON envelope that is posted to the /services/collector/event path. We define a write endpoint for this path and a mapping that feeds it from the MQTT topic hierarchy.
The HTTP/REST connector expects the request body in the body property of the message (see Publishing Data to REST Servers). The transform rule builds the HEC envelope inside this body property, so machines can publish their data without knowing about either convention.
The envelope properties have the following meaning in Splunk:
event: The event payload. The transform passes the incoming MQTT message through unchanged.time: The event time in epoch seconds. HEC accepts fractional values, so$millis() / 1000keeps millisecond precision. If your machine payload already carries an event timestamp, use that field instead.host,source, andsourcetype: Descriptive metadata for filtering and parsing in Splunk. This example uses the cell level of the topic as the host.index: The Splunk index that receives the event. If you omit this property, HEC uses the default index of the token.fields: A flat object of custom fields that Splunk indexes directly. The named wildcards of the topic make the equipment hierarchy levels available in$context.vars, so every event is searchable bysite,area,line, andcellwithout any search-time extraction. Indexed fields require the/services/collector/eventpath, they are not supported for raw data.
Any message published to a matching topic now becomes one Splunk event. For example, a machine stop published to enterprise/hamburg/assembly/line-1/press-01/events:
This results in an event in the main index with the source type connectware:event, the host press-01, and the indexed fields site=hamburg, area=assembly, line=line-1, and cell=press-01.
Verifying the Integration
Install the service and set the parameters with the values of your Splunk instance.
Check that the connection is in the Connected state on the service details page in the Admin UI. The probe calls the HEC health endpoint, so a connected state confirms the address and the TLS setup. A wrong token only shows up when the first event is sent.
Publish a test message to
enterprise/hamburg/assembly/line-1/press-01/events, for example with an MQTT client or the Admin UI.Open the Search & Reporting app in Splunk and run the search
index=main sourcetype="connectware:event"over the last 15 minutes. The test message appears as an event, and you can narrow the search with the indexed fields, for examplesite=hamburg.The result of every HTTP request is published to the
/restopic of the endpoint. Use the Data Explorer to inspect it. On success, the result contains the HEC response{"text":"Success","code":0}. If Splunk rejects a request, the message on the/restopic contains anerrorproperty with the HTTP status, for example403 Forbiddenfor an invalid token.
Service Commissioning File Example
Last updated
Was this helpful?

