Getting Data In

Timestamp Minute and Second need to have a leading 0 for Splunk to recognize

cmak
Contributor

I have the following line in props.conf

TIME_FORMAT = %m/%d/%Y %H:%M:%S

I have the following timestamp:

"2/23/2013 9:21:21"

Splunk can recognize that. However, without the leading 0 in minutes or seconds (if value is less than 10), Splunk cannot recognize the timestamp.

"2/23/2013 9:1:01"
"2/23/2013 9:01:1"

How can this be fixed?

Tags (1)
0 Karma

kristian_kolb
Ultra Champion

Very good idea indeed. If possible (or required) you could/should also add subseconds and TZ.

/k

0 Karma

cmak
Contributor

I ended up simply changing my timestamp so that it has 2 digits for minutes and seconds

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

You can give %#M and %#S a try.

0 Karma

cmak
Contributor

When I have "2/23/2013 9:1:01", it thinks it is "2/23/2013 1:01:00" and skips the hour.

All other cases that have 1 digit as M or S will simply use index time as the event time stamp

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

For me even %m/%d/%Y %H:%M:%S works well with all these timestamps:

2/23/2013 9:1:1
2/23/2013 9:01:1
2/23/2013 9:1:01
2/23/2013 9:01:01
0 Karma

cmak
Contributor

TIME_FORMAT = %m/%d/%Y %k:%#M:%#S

This still seems to need the leading zero

0 Karma

kristian_kolb
Ultra Champion

Try with %k or %l instead of %H (depending on whether you have 0-24 or 0-12 for the hour. Since there is no AM/PM in your timestamp, I'd guess that you have a 24-hour clock.

See http://www.strftime.net

Hope this helps,

Kristian

0 Karma

cmak
Contributor

Thanks for the info about %k

0 Karma

kristian_kolb
Ultra Champion

oops, just saw that you had the same problem for minutes and seconds... hmm... mm...mmm....

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!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...