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!

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk on November 6 at 11AM PT, and empower your SOC to reach new heights! Duration: ...

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...