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!

.conf24 | Day 0

Hello Splunk Community! My name is Chris, and I'm based in Canberra, Australia's capital, and I travelled for ...

Enhance Security Visibility with Splunk Enterprise Security 7.1 through Threat ...

(view in My Videos)Struggling with alert fatigue, lack of context, and prioritization around security ...

Troubleshooting the OpenTelemetry Collector

  In this tech talk, you’ll learn how to troubleshoot the OpenTelemetry collector - from checking the ...