Getting Data In

JSON timestamp parsing- When events are being fed from UF, the timestamp can't be extracted?

stwong
Communicator

Hi all,

I use following simple props.conf to some json type events:

[my:sourcetype]
category = Structured
DATETIME_CONFIG =
LINE_BREAKER=([\r\n]+)
NO_BINARY_CHECK=true
CHARSET=UTF-8
INDEXED_EXTRACTIONS=json
TIME_FORMAT=%s
disabled=false
pulldown_type=true
SHOULD_LINEMERGE=false
TIMESTAMP_FIELDS=timestamp

 

The event looks like following:

{"access_device": {"browser": "Edge Chromium", "browser_version": "108.0.1462.54", "epkey": null, "flash_version": "uninstalled", "hostname": null, "ip": "192.168.182.230", "is_encryption_enabled": "unknown", "is_firewall_enabled": "unknown", "is_password_set": "unknown", "java_version": "uninstalled", "location": {"city": "Bestine", "country": "Tatooine", "state": "Central and Western District"}, "os": "Windows", "os_version": "10"}, "adaptive_trust_assessments": {}, "alias": "unknown", "application": {"key": "ABCDEFG1234567", "name": "[UAT] Hello World App"}, "auth_device": {"ip": null, "key": null, "location": {"city": null, "country": null, "state": null}, "name": null}, "email": null, "event_type": "authentication", "factor": "not_available", "isotimestamp": "2022-12-20T09:14:08.755759+00:00", "ood_software": null, "reason": "allow_unenrolled_user", "result": "success", "timestamp": 1671527648, "txid": "c571233d-b357-3f07-e126-ca2623b8e0d9", "user": {"groups": [], "key": null, "name": "luke"}, "eventtype": "authentication", "host": "jedi1.mydomain.com"}

 

It works when i test it through upload log file by setting sourcetype to my:sourcetype.  Fields and timestamp can be extracted.

However, when events are being fed from UF, the timestamp can't be extracted and  using the file modified time as timestamp instead.

Tried to add 'TIME_PREFIX=timestamp": ' but didn't help.

Would anyone please help?

Thanks and Regards

 

Labels (1)
0 Karma

stwong
Communicator

Hi all,

 

Thanks for your help.   

Found that the problem is caused by putting some settings in props.conf in the wrong place.
The problem is resolved after putting following on the UF:

INDEXED_EXTRACTIONS = json
TIMESTAMP_FIELDS = timestamp

and put KV_MODE=none on search head.

I have mistaken that index extraction always occurs on indexer which seems depends, based on this:
https://www.aplura.com/assets/pdf/where_to_put_props.pdf

Thanks again.

Best Rgds

 

richgalloway
SplunkTrust
SplunkTrust

It sounds like Splunk is not finding the right timestamp field when the data comes from the UF.  Verify inputs.conf on the UF has the right sourcetype value.

The TIME_PREFIX setting you tried is ambiguous.  The first match is "isotimestamp" which has a value that is not an epoch timestamp and Splunk perhaps doesn't find an epoch in the next MAX_TIMESTAMP_LOOKAHEAD characters.  Try this setting

TIME_PREFIX = "timestamp":

 

---
If this reply helps you, Karma would be appreciated.

wmazur-splunk
Splunk Employee
Splunk Employee
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 ...