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!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

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