Splunk Search

Basic percentage question

user93
Communicator

I am trying to count click through, the percent of total clicks over total searches. 

 

index=basesearch action=click OR action=search 

|stats count by action

What I really want is a percent number of action=clicks divided by action=search. What command do i use? 

Labels (1)
0 Karma
1 Solution

s2_splunk
Splunk Employee
Splunk Employee

Try this: 

<yourbasesearch> | stats count(eval(action="click")) as clickCount, count(eval(action="search")) as searchCount | eval percentage = clickCount/searchCount

View solution in original post

s2_splunk
Splunk Employee
Splunk Employee

Try this: 

<yourbasesearch> | stats count(eval(action="click")) as clickCount, count(eval(action="search")) as searchCount | eval percentage = clickCount/searchCount
Get Updates on the Splunk Community!

New Case Study Shows the Value of Partnering with Splunk Academic Alliance

The University of Nevada, Las Vegas (UNLV) is another premier research institution helping to shape the next ...

How to Monitor Google Kubernetes Engine (GKE)

We’ve looked at how to integrate Kubernetes environments with Splunk Observability Cloud, but what about ...

Index This | How can you make 45 using only 4?

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