All Apps and Add-ons

How to use TIME_PREFIX to extract Timestamp for the JSON logs?

kiran331
Builder

How to Extract the timestamp (Date: in below screenshot) which is in UTC format and convert to CST format? current timestamp is indexing timestamp.

alt text

0 Karma

sravankaripe
Communicator

[ _json ]
BREAK_ONLY_BEFORE={"preview"
pulldown_type=true
TIME_PREFIX=\s\\"date\\":\s+\\"

0 Karma

sravankaripe
Communicator

Try this or above stanza

[ _json ]
BREAK_ONLY_BEFORE={"preview"
TIME_PREFIX=\s\\"date\\":\s+\\"
TIME_FORMAT=%Y-%m-%dT%H:%M:%S+%N:%N
TRUNCATE=9999999

0 Karma

davpx
Communicator

TIME_PREFIX = timestamp:\s+
TIME_FORMAT = %s

in props.conf

0 Karma

kiran331
Builder

I tried it din't work.

0 Karma

splunker12er
Motivator
yoursearch| eval CST_time=_time-21600| convert ctime(CST_time)|table CST_time , _time

yoursearch| eval CST_time=now()-21600| convert ctime(CST_time)|table CST_time , _time

Central Standard Time (CST) is 6 hours behind Coordinated Universal Time (UTC).
where your _time is UTC

0 Karma

kiran331
Builder

Is there a way to do it at indexing time?

0 Karma
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 ...