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
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...