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!

Modern way of developing distributed application using OTel

Recently, I had the opportunity to work on a complex microservice using Spring boot and Quarkus to develop a ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had 3 releases of new security content via the Enterprise Security ...

Archived Metrics Now Available for APAC and EMEA realms

We’re excited to announce the launch of Archived Metrics in Splunk Infrastructure Monitoring for our customers ...