Getting Data In

TIME_FORMAT regex help

Esky73
Builder

12/02/2015 12:00:00 AM, Execute time: 0150

looking to extract the date and the 24hr time pls

Tags (1)
0 Karma

jplumsdaine22
Influencer

See here for the time format variables
https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Commontimeformatvariables

Assuming the date is month/day/year and the time is a 12 hour clock (not 24 hour as you say), try
TIME_FORMAT = %m/%d/%Y %I:%M:%S %p

Esky73
Builder

it is definitely 24h - thanks i'll try first thing in the morn

0 Karma

jplumsdaine22
Influencer

If its 24 hours, why does it have a AM/PM ? 16:00:00 AM wouldn't make much sense!

0 Karma

Esky73
Builder

i see your point - however, further entries:

12/02/2015 12:00:00 AM, Execute Time: 1415
12/02/2015 12:00:00 AM, Execute Time: 1500
12/02/2015 12:00:00 AM, Execute Time: 1515
12/02/2015 12:00:00 AM, Execute Time: 1315

0 Karma

harshal_chakran
Builder

Try this:

rex field=_raw "(?ms)^(?P\d{2}\/\d{2}\/\d{4}\s+\d{2}:\d{2}:\d{2}\s+\w{2})"

You can use Splunk's "Extract Fields" from Event Actions to perform the same.

0 Karma

Esky73
Builder

hi thanks - i'm trying to do this in a props.conf file - not in a search

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...