Getting Data In

split url and perform a count on it.

rh990
Engager

You'll have to pardon the newbie question. I'm sure this is crazy easy, but I'm having the worst time figuring it out. My logs have a URL field in them and I want to split out the query string and do a count on the URL minus the query sting. I've tried a bunch of different things, but nothing I've tried has really gotten me what I'm after.

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/symbol/ 3
www.nasdaq.com 1

Tags (2)
0 Karma
1 Solution

sundareshr
Legend

Try this

... | eval url=mvindex(split(request_uri, "?"), 0) | stats count by url

View solution in original post

aluruguna
Engager

I want answer for exactly same question but I want the count value of everything group urls i.e---

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

sundareshr
Legend

Try this

... | eval url=mvindex(split(request_uri, "?"), 0) | stats count by url

rh990
Engager

I've tried this one and I get no results for statistics when I use it. I see plenty of results for events, but nothing for statistics.

index="sss" Application.AppName = "xxxx*" Header.Type=inbound | eval url=mvindex(split(Service.URL, "?"), 0) | stats count by url
0 Karma

somesoni2
Revered Legend

Your field name contains special characters, so in eval (and where) command, use it within single quotes. Like this

index="sss" Application.AppName = "xxxx*" Header.Type=inbound | eval url=mvindex(split('Service.URL', "?"), 0) | stats count by url

rh990
Engager

The special character in the field name was it. Thank you so much. I figured it was something simple, I'm just new to it.

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!

Unlocking Unified Insights: New Gigamon Federated Search App for Splunk

In today’s data-heavy environment, organizations are caught in a data distribution dilemma. As data volumes ...

GA: New Data Management App in Splunk Platform

Streamlining Data Management: Introducing a unified experience in Splunk Managing data at scale shouldn’t feel ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...