Getting Data In

How to extract timestamp from JSON file

jwalzerpitt
Influencer

I am uploading a JSON file into a test index and I'm trying to set the timestamp for and prefix. The events in the JSON file always start as follows:

{'received': '2020-02-27 10:49:07', 'operator_id': None, 'sender':

I configured the Timestamp format as follows:

%Y-%m-%dT%H:%M:%S

and the Timestamp prefix as:

'(\d{4})-(\d{2})-(\d{2})\s(\d{2}:\d{2}:\d{2})'

and when I tab out of the field, I still get the message of, "No results found. Please change source type, adjust source type settings, or check your source file."

Is there something wrong with my format or prefix (or both)?

Thx

0 Karma

manjunathmeti
SplunkTrust
SplunkTrust

Yes, JSON is not valid. Put keys and string values in double quotes like below, change Timestamp format to %Y-%m-%d %H:%M:%S and add new setting (under Advanced dropdown) TIMESTAMP_FIELDS = received.

{"received": "2020-02-27 10:49:07", "operator_id": "None", "sender": "A"}

0 Karma

to4kawa
Ultra Champion

prefix is a word, letter, or number placed before another.

[your sourcetype]
TIME_PREFIX = received\':\s\'
TIME_FORMAT = %F %T
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...