Splunk Search

help with regex

vrmandadi
Builder

I have the below sample data, and I want to extract everything after the service URL till maxd=60&mind=60 into a new field called service.

I have used (?i) url: (?P.+?)\w+= but it is not extracting completly

31 Jan 2018 20:22:13 [INFO ] AD Transaction: timestamp: 1513204259, transactionID: 2899739, reqID: 3022368026, uuid: 72dca744-b342-4aac-9861-005056b21335, type: ad request, transaction: start, service url: http://mrm.mdc.time.com/ad/p/1?nw=376521&mode=live&vdur=600&flag=+sltp+amsl+ssus+amcb+dtrd&metr=1031..., client url: http://mmdai-linear-west-01.time.com
0 Karma
1 Solution

493669
Super Champion

try this also:

...| rex "(?i)service url:\s*(?<service>.*)&maxd=60&mind=60" 

View solution in original post

0 Karma

mayurr98
Super Champion

hey try this run anywhere search

| makeresults 
| eval _raw="31 Jan 2018 20:22:13 [INFO ] AD Transaction: timestamp: 1513204259, transactionID: 2899739, reqID: 3022368026, uuid: 72dca744-b342-4aac-9861-005056b21335, type: ad request, transaction: start, service url: http://mrm.mdc.time.com/ad/p/1?nw=376521&mode=live&vdur=600&flag=+sltp+amsl+ssus+amcb+dtrd&metr=1031..., client url: http://mmdai-linear-west-01.time.com"; 
| rex field=_raw "service\surl\:\s+(?<service_URL>.*)&maxd=60&mind=60"

In your environment, you should write

<base_search> | rex field=_raw "service\surl\:\s+(?<service_URL>.*)&maxd=60&mind=60"

let me know if this helps!

0 Karma

493669
Super Champion

try this also:

...| rex "(?i)service url:\s*(?<service>.*)&maxd=60&mind=60" 
0 Karma

vrmandadi
Builder

This helped,made some changes to it..Thanks

0 Karma

gokadroid
Motivator

How about trying this:

your query to return events
| rex "service url:\s*(?<service>.*)&maxd=60&mind=60"
| table service

see extraction here

0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...