Getting Data In

How to extract timezone in json?

paxtaru
Explorer

We have a log that we've been asked to ingest which is a json format file that's similar to this:

 {"type":"appRequest",
    "severity":"INFO",
    "eventid":"abcdefg1234567",
    "userid":76965813945444,
    "timezone":7,
    "timestamp":"2019-10-30T23:57:59.958Z",
    "logLevel":"INFO",
    "url":"/some/url",
    "diagnosticsEventId":"someEventId",
    "startTime":1572479879958,
    "logDetails":"200,OK"}

As you can see, the timezone is specified in a field instead of built into the timestamp string. I've look around to no avail, is there a way to specify the event timezone based on the timezone (this is offset to GMT in hours)?

0 Karma
1 Solution

arjunpkishore5
Motivator

The timestamp is of GMT format(Z at the end indicates time is GMT). Assuming that the source has actually put in the timestamp in GMT and not just stamped the local time with the GMT format, you could just ingest it as GMT. Based on the timezone set in your profile, Splunk would convert the timestamp to your local timestamp.

EDIT: I just converted the startTime field in https://www.epochconverter.com/ and it looks like the timestamp is actual GMT and not just local time stamped in GMT format.

View solution in original post

0 Karma

paxtaru
Explorer

Thank you. It's a misunderstanding on my part. I will confirm with our developer as well just to make sure.

0 Karma

arjunpkishore5
Motivator

The timestamp is of GMT format(Z at the end indicates time is GMT). Assuming that the source has actually put in the timestamp in GMT and not just stamped the local time with the GMT format, you could just ingest it as GMT. Based on the timezone set in your profile, Splunk would convert the timestamp to your local timestamp.

EDIT: I just converted the startTime field in https://www.epochconverter.com/ and it looks like the timestamp is actual GMT and not just local time stamped in GMT format.

0 Karma

Labbemiche
Engager

I have this issue as well but without the benefit of logs in GMT. My logs are multiple time zones in a single host, index, source, sourcetype combo. Here's an example:

{ [-]
   AppID:
   ElapsedSeconds: 0.694 seconds
   Event: RestCall
   Method: POST
   Request: { [+]
   }
   RequestLength: 371
   RequestTimestamp: 16-Nov-2022 12:59:54
   Response: { [+]
   }
   ResponseLength: 286
   ResponseTimestamp: 16-Nov-2022 12:59:55
   SequenceNumber: null
   ServiceName:
   ServiceURL: 
   StatusCode: 200
   StatusText: OK
   TimeZone: Asia/Shanghai
   UserID:
   UserIP: 127.0.0.1
   UserName: 
}

 

In total there are about 85 different timezones logging here. Any idea how to get Splunk to recognize the timezone when not with the time stamp? 

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

Monitoring AI Agents with Splunk Observability Cloud

Let’s say I’m running a travel planning AI app in production. A user asks for three concise hotel options in ...

[Puzzles] Solve, Learn, Repeat: Tiling

This puzzle (first published here) is based on finding groups of tessellated tiles (inspired by floor tiles I ...

SOK it to Me: Top 3 Benefits of Using Splunk Operator on Kubernetes that’ll Make ...

    Thursday, July 9, 2026  |  11:00AM–12:00PM PDT Duration: 1 hour (includes Q&A) Managing can feel like a ...