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!

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...