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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...