Splunk Enterprise

HEC token use for the source to Splunk

uagraw01
Motivator

Hello Splunkers!!

I have ingested data into Splunk from the source system using the URI "https://localhost:8088/services/collector" along with the HEC token. However, the data is not being displayed in Splunk with the appropriate sourcetype parsing, which is affecting the timestamp settings for the events.

The sourcetype and timestamp are currently being displayed as below.

uagraw01_1-1727249483055.png

My actual props.conf setting as below :

[agv_voot]
DATETIME_CONFIG =
LINE_BREAKER = ([\r\n]+)
NO_BINARY_CHECK = true
category = Custom
KV_MODE = json
pulldown_type = 1
TIME_PREFIX = ^\@timestamp
TIME_FORMAT = %Y-%m-%dT%H:%M:%S.%3N
TIMESTAMP_FIELDS = @timestamp
TRANSFORMS-trim_timestamp = trim_long_timestamp
transforms.conf

[trim_long_timestamp]
REGEX = (\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3})\d+(-\d{2}:\d{2})
FORMAT = $1


Please help to fix the proper parsing with correct sourcetype and timestamp.

0 Karma
1 Solution

PickleRick
SplunkTrust
SplunkTrust

https://docs.splunk.com/Documentation/Splunk/latest/RESTREF/RESTinput#services.2Fcollector.2Fevent

services/collector/event

Sends timestamped events to HTTP Event Collector using the Splunk platform JSON event protocol when auto_extract_timestamp is set to "true" in the /event URL.

  • An example of a timestamp is: 2017-01-02 00:00:00.
  • If there is a timestamp in the event's JSON envelope, Splunk honors that timestamp first.
  • If there is no timestamp in the event's JSON envelope, the merging pipeline extracts the timestamp from the event.
  • If "time=xxx" is used in the /event URL then auto_extract_timestamp is disabled.
  • Splunk supports timestamps using the Epoch format.

In other words - unless you specify your URI as /services/collector/event?auto_extract_timestamp=true your timestamp will _not_ be extracted from the event itself (Splunk will not even bother looking for it - it will either get the data from the json envelope or will assume current timestamp if there is no timestamp in the envelope). And even if the auto_extract_timestamp parameter is set to true, in cases listed above extraction is not performed either.

See also https://www.aplura.com/assets/pdf/hec_pipelines.pdf

View solution in original post

PickleRick
SplunkTrust
SplunkTrust

https://docs.splunk.com/Documentation/Splunk/latest/RESTREF/RESTinput#services.2Fcollector.2Fevent

services/collector/event

Sends timestamped events to HTTP Event Collector using the Splunk platform JSON event protocol when auto_extract_timestamp is set to "true" in the /event URL.

  • An example of a timestamp is: 2017-01-02 00:00:00.
  • If there is a timestamp in the event's JSON envelope, Splunk honors that timestamp first.
  • If there is no timestamp in the event's JSON envelope, the merging pipeline extracts the timestamp from the event.
  • If "time=xxx" is used in the /event URL then auto_extract_timestamp is disabled.
  • Splunk supports timestamps using the Epoch format.

In other words - unless you specify your URI as /services/collector/event?auto_extract_timestamp=true your timestamp will _not_ be extracted from the event itself (Splunk will not even bother looking for it - it will either get the data from the json envelope or will assume current timestamp if there is no timestamp in the envelope). And even if the auto_extract_timestamp parameter is set to true, in cases listed above extraction is not performed either.

See also https://www.aplura.com/assets/pdf/hec_pipelines.pdf

Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...