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
Get Updates on the Splunk Community!

Data Management Digest – December 2025

Welcome to the December edition of Data Management Digest! As we continue our journey of data innovation, the ...

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...