Splunk Search

How to generate a search that will group a URL field and perform total count?

aluruguna
Engager

I would like to group URL fields and perform a total count. An example might be like:
www.nasdaq.com/symbol/?Load=true&Search=ssss
www.nasdaq.com/symbol/?Load=true&Search=ddd
www.nasdaq.com/symbol/?Load=true&Search=xxx
www.nasdaq.com

I'd like to see
www.nasdaq.com 4

I was using My search|stats count by url but I'm getting all the results like this

URL                                                               Count
www.nasdaq.com/symbol/?Load=true&Search=ssss                        1
www.nasdaq.com/symbol/?Load=true&Search=ddd                         1
www.nasdaq.com/symbol/?Load=true&Search=xxx                         1
www.nasdaq.com                                                      1

I'd like to see

URL                                                               Count
www.nasdaq.com                                                      4
0 Karma
1 Solution

gokadroid
Motivator

What you would require to do is extract the base url from the url field and count on them like this:

yourQuery to return field url
| rex field=url "^(?<baseUrl>[^\/\s]+)"
| stats count by baseUrl

See the extraction of baseUrl from url here

View solution in original post

gokadroid
Motivator

What you would require to do is extract the base url from the url field and count on them like this:

yourQuery to return field url
| rex field=url "^(?<baseUrl>[^\/\s]+)"
| stats count by baseUrl

See the extraction of baseUrl from url here

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