Splunk Search

Extracting field using rex for URL

JoshuaJohn
Contributor

I have this search:

index=nitro_prod_ecomm sourcetype = nitro_access_log earliest=-30m@m | rex field=_raw "\d\d\:\d\d\:\d\d\s+(?\d+\.\d+)" | search ResponseTime>1

That gives me results like this:

10.022.020.203  10.200.130.180:7001 -   2016-08-15  01:09:02    4.55    GET   /product/nitro?skuId=11023031 skuId=11023031  200 124221]"

10.402.300.103  10.200.111.116:7001 -   2016-08-15  01:09:00    6.033   POST /myaccount/json/acc_nitro_login_json.jsp   -   302 0]"

I want to get "product" & "myaccount" into a field called page, basically whatever that first word is after GET, and POST

Any solutions? I can get the entire URL but I am unsure as to how to get just that first part.

0 Karma
1 Solution

skoelpin
SplunkTrust
SplunkTrust

Try this

... | rex (?<page>(GET|POST)\s+\/(\w+))

View solution in original post

0 Karma

skoelpin
SplunkTrust
SplunkTrust

Try this

... | rex (?<page>(GET|POST)\s+\/(\w+))

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 ...