Splunk Search

Weight host using lookup table.

jevenson
Path Finder

I'm trying to get a weighted ratio of errors per server. I have a lookup table like this:

host,percent
server1,25
server2,25
server3,50

Normally I'd do something like sourcetype=iis sc_status=500 [| inputlookup ratio | fields host] | chart count by host, which gives me a count of errors by server, but I want a weighted count based on that percent.

How would I use the lookup table to multiply the errors on a per server basis?

Tags (1)
0 Karma
1 Solution

Ayn
Legend

Hi! 🙂

So, if what you want to do it multiply the count by the defined percent value for each of these hosts, you could do something like:

sourcetype=iis sc_status=500 [| inputlookup ratio | fields host] | lookup yourlookuptable host OUTPUT percent | chart count by host | eval weightedcount=count*percent/100

View solution in original post

Ayn
Legend

Hi! 🙂

So, if what you want to do it multiply the count by the defined percent value for each of these hosts, you could do something like:

sourcetype=iis sc_status=500 [| inputlookup ratio | fields host] | lookup yourlookuptable host OUTPUT percent | chart count by host | eval weightedcount=count*percent/100
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, ...