Getting Data In

timestamp extraction for time format with leading zero omitted in the event

alextsui
Path Finder

Hi, I would like to extract timestamp from events where the leading zeros of the time format are omitted. Most of the events have the time format like the example below, where Splunk is able to extract the correct time for the events to be 2010/03/22 11:59:49 pm.

20100322,235949,1=1,52=M2010032223594908434,11=192.168.99.132,2=20

However the leading zeros in the time format are omitted. For exmaple "20100322,314,..." means 2010/03/22 00:03:14 am.

Splunk extracts incorrectly for the following event sample to 2010/03/22 10:05:08 pm. The correct time for the event below should be 2010/03/22 02:20:58 am:

20100322,22058,1=1,110=250 U2M2Kv0225593 Message accepted

At the extreme end, events with 5 omitted leading zeros in the time format like 20100322,1,1=1,...., and it's timestamp should be 2010/03/22 00:00:01 am.

What's best way to extract such time format from the events? If it involves modifying the datetime.xml, please kindly provide the REGEX.

Thanks.

Tags (1)

dwaddle
SplunkTrust
SplunkTrust

I'm not sure this is possible. Parsing is difficult when there is ambiguity - would a time of "1111" be 00:11:11, 11:11:00 or 01:01:01?

In my opinion, this is the type of problem where for the sake of your own sanity you are far better off to try to get the source application fixed to where it either delimits Hour, Minute, Second, Subsecond or 0-fills appropriately.

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!

Index This | What travels the world but is also stuck in place?

April 2026 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...