Splunk Search

Extract from URL

smahuja
Explorer

Hi,

 

I have following kind of url :

  1. https://abc.com/loc/country/123/iss
  2. https://abc.com/a1/v1/country/456.json?returnFields=attr,add
  3. https://abc.com/a1/countries/456/av/int/orig/curr

I want to extract numbers(123,456) , in url whatever comes after country / countries , want that digit.

Thanks in advance

Thanks,

 

Labels (1)
0 Karma

spitchika
Path Finder

This works for you...

| makeresults
| eval value="https://abc.com/a1/countries/456/av/int/orig/curr"
| rex field=value "coun\D+(?<Num_value>\d+)"
| stats values(Num_value)

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

.conf26 Registration is Live: Secure Your Early Bird Pass Now

  Lock in Your Spot: Registration Open for .conf26 in Denver Hello Splunkers, I have exciting news! Your ...

Mile High Learning with Splunk University, Denver, Colorado

If Denver is known for its mile-high elevation, Splunk University is about to raise the bar on technical ...

IT Service Intelligence 5.0 Series: Your Guide to the June Launch

We are excited to announce the June release of Splunk IT Service Intelligence (ITSI) 5.0. This update ...