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!

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...