Splunk Search

field extraction

sarit_s
Communicator

Hello
i have this part of event :

"POST /posts/posts/explore HTTP/1.0"

i need to extract the part between "POST" and "HTTP"
which "POST" can be anything, for example "GET", "PUSH", etc.
also, the string between "POST" and "HTTP" can contain only 1 '/', for example "POST /search HTTP..."
what is the right regular expression for that ?

thanks !

0 Karma
1 Solution

to4kawa
Ultra Champion
your_search
| rex "[A-Z]+\s(?<url>.+?)\sHTTP\/\d\.\d"

Hi, how about this?

View solution in original post

0 Karma

to4kawa
Ultra Champion
your_search
| rex "[A-Z]+\s(?<url>.+?)\sHTTP\/\d\.\d"

Hi, how about this?

0 Karma

p_gurav
Champion

What is the data source for this logs? If this are access logs then try to use splunk predefined sourcetypes.

0 Karma

sarit_s
Communicator

its log file that i added manually from "add data" option

0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...