Splunk Search

How to edit my search to create a new extracted field with rex?

JoshuaJohn
Contributor

I have this search

index=nitro_prod_ecomm earliest=-30m@m | rex field=_raw "\d\d\:\d\d\:\d\d\s+(?\d+\.\d+)" | where ResponseTime>1| rex field=_raw "(?(GET|POST)\s+\/(\w+))" |stats count by header_page

It gets me the first part of a URL from the raw rex field, which is what I want.
I want to get this information into my extracted fields section on the left, I want to be able to click "header_page" and it will show me what is being displayed by this search such as "GET /store" etc. (Like below)
alt text

When attempting to create an extracted field via the automatic builder, it cannot do it and needs a custom written one. I tried just using the rex from the search, but it didn't seem to work.

Any ideas?

0 Karma
1 Solution

sundareshr
Legend

Add this to your props.conf

[sourcetype_stanza]
EXTRACT-headepage = (?<header_page>(GET|POST)\s+\/(\w+))

http://docs.splunk.com/Documentation/Splunk/6.4.2/Knowledge/Createandmaintainsearch-timefieldextract...

View solution in original post

0 Karma

sundareshr
Legend

Add this to your props.conf

[sourcetype_stanza]
EXTRACT-headepage = (?<header_page>(GET|POST)\s+\/(\w+))

http://docs.splunk.com/Documentation/Splunk/6.4.2/Knowledge/Createandmaintainsearch-timefieldextract...

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Can you share some sample data?

---
If this reply helps you, Karma would be appreciated.
0 Karma

JoshuaJohn
Contributor

header_page ________________count
GET /price
_______________________ 3
GET /product_________________3956
POST /rest
__________________373
GET /search
________________355
GET /search_error _
____________1
GET /store
______________________382

Basically this ^

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