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 Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...