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!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...