Getting Data In

Capture second timestamp that includes subseconds

vlicoupons
Engager

Here's an example beginning of an event line

Oct 20 20:57:03 sfo-prd-wsux02 apache2: [Fri Oct 20 20:57:03.398765 2017] [proxy:error] [pid 32083:tid 140031679186688]

I'm trying to capture the second timestamp as "Fri Oct 20 20:57:03.398765 2017" that includes the subseconds

In props.conf I am putting:

[syslog_apache_error]
TIME_PREFIX = ^.*[
TIME_FORMAT = %a %b %d %H:%M:%S:.%6N %Y

However Splunk's timestamp is catching the decimals, please advise.
Thank you all

0 Karma
1 Solution

DalJeanis
Legend

There is no colon after the seconds in your timestamp, but there is one in your TIME_FORMAT.

Try...

 TIME_FORMAT = %a %b %d %H:%M:%S.%6N %Y

View solution in original post

DalJeanis
Legend

@vlicoupons - if your issue has been solved, then please accept the answer so the question will show as closed. Also, please feel free to upvote any comments or other answers you found useful. If you still have open issues regarding this, please let us know how else we can help.

0 Karma

DalJeanis
Legend

There is no colon after the seconds in your timestamp, but there is one in your TIME_FORMAT.

Try...

 TIME_FORMAT = %a %b %d %H:%M:%S.%6N %Y

vlicoupons
Engager

Ah nice catch I must've been hasty on the keyboard and added the extra semicolon after the seconds variable.

cpetterborg
SplunkTrust
SplunkTrust

Your TIME_PREFIX is also doing a greedy match, so it may be passing over the field you want, deciding it doesn't have a valid timestamp, and then defaulting to the first timestamp it sees. Use a lazy match like this:

TIME_PREFIX=^.*?\[

That will stop at the first square bracket instead of the last one.

DalJeanis
Legend

@cpetterborg - good improvement. No sense overshooting and having to back up.

0 Karma
Get Updates on the Splunk Community!

Splunk Platform | Upgrading your Splunk Deployment to Python 3.9

Splunk initially announced the removal of Python 2 during the release of Splunk Enterprise 8.0.0, aiming to ...

From Product Design to User Insights: Boosting App Developer Identity on Splunkbase

co-authored by Yiyun Zhu & Dan Hosaka Engaging with the Community at .conf24 At .conf24, we revitalized the ...

Detect and Resolve Issues in a Kubernetes Environment

We’ve gone through common problems one can encounter in a Kubernetes environment, their impacts, and the ...