When you send data to the HTTP Event Collector (HEC) in Splunk without specifying a sourcetype, Splunk will use the default settings configured for the HEC token. Here’s what happens:
sourcetype is not specified in the payload or HEC token configuration, Splunk will attempt to automatically assign a sourcetype based on the input type or will use a default generic sourcetype like hec_event.sourcetype is often "_json" if Splunk detects a JSON-formatted payload, which enables automatic JSON field extraction._json Sourcetype:sourcetype is not specified, Splunk assigns the sourcetype as "_json".sourcetype is "_json", Splunk automatically parses the JSON structure and extracts the key-value pairs as fields.Example:
Payload sent without sourcetype:
json
{
"event": {
"host": "test-server",
"plugin": "cpu",
"values": [25.5]
}
}
Splunk will typically interpret this with sourcetype="_json" and extract fields like host, plugin, and values.
sourcetype set. You can check or modify this by:
Default Index and Default Sourcetype. If the sourcetype is not set, it may default to hec_event or "_json".sourcetype is not specified, Splunk may assign a generic sourcetype like hec_raw or hec_event and will not perform automatic parsing._raw), and no additional fields are extracted unless you manually configure extractions using Field Extractions or Transforms.sourcetype ExplicitlyTo ensure that the data is parsed correctly and fields are extracted as expected, it is a good practice to explicitly specify the sourcetype in the payload or configure it in the HEC token settings.
Example of Specifying sourcetype in Payload:
json
{
"sourcetype": "collectd_json",
"event": {
"host": "test-server",
"plugin": "cpu",
"values": [25.5]
}
}
_internal index for HEC logs if the data does not appear as expected:
spl
index=_internal source=*splunkd.log* "HTTP Event Collector"
index=* to locate unparsed raw events:
spl
index=* | head 10
This should help you understand where the data goes and how it is handled when the sourcetype is not explicitly defined. Let me know if you need more details or specific examples!