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!

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