Getting Data In

Day Of Month Field Without A Leading Zero

sajbutler
Path Finder

I have a log which contains entries like the following:

(3/07/12 13:13:09) 8856: < RingBufferModule::initialize()
(3/07/12 13:13:09) 8857: Finished init of: 'RingBufferLoggingAppender'
(3/07/12 13:13:09) 8858: Initializing 'AudioPathController'
(3/07/12 13:13:09) 8859: Unable to find value for key: 'SrxSupervisorAudioEnable'

The date component is day/month/year. So in the above example, we have the 3rd July 2012. As you can see, the day of month (i.e. 3 in the above example) does not contain a leading zero. According to strptime, %d represents 01-31 and there seems to be nothing for 1-31. I've tried the following in props.conf but to no avail:

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

Any suggestions to this would be appreciated.

Tags (2)
0 Karma
1 Solution

itinney
Path Finder

You are missing a slash after the %d and before %m in your first post.
I always use %Y for four-digit year and %y for two-digit year.
%d is always zero-padded (03/07/12)
%e is space-padded ( 3/07/12)
I would try:

%e/%m/%y %H:%M:%S

OR

%e/%m/%y %T 

View solution in original post

itinney
Path Finder

You are missing a slash after the %d and before %m in your first post.
I always use %Y for four-digit year and %y for two-digit year.
%d is always zero-padded (03/07/12)
%e is space-padded ( 3/07/12)
I would try:

%e/%m/%y %H:%M:%S

OR

%e/%m/%y %T 

sajbutler
Path Finder

Missing slash. Ouch. The %e space pads and works fine. I can confirm that the following following config in props.conf works:
TIME_FORMAT=%e/%m/%g %H:%M:%S
TIME_PREFIX=[(]

0 Karma

yannK
Splunk Employee
Splunk Employee

There is a strange double space in your timeformat.

Also, you could try to add the characters around.

 
TIME_FORMAT=(%d/%m/%g %H:%M:%S)

0 Karma

sajbutler
Path Finder

Thanks for the suggestions yannK.

I've removed the double space from the TIME_FORMAT and also tried enclosing in brackets but still no good.

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...