Splunk Search

help for displaying 2 results in a single panel

jip31
Motivator

hello
I use the search below in order to display the result (count) in a single value panel
In the same single value, I would like to have the volume of events in addition to the count
for example, if the count result is 5, I would like to have the volume of online machines
it means that I have to count the number of machines in [| inputlookup host.csv
| table host] and to divise this result by the result of the count
So if the machines count of inputlookup host.csv is 40, I have to divise 5 by 40 in order to know the volume of machines in %
Could you help me please

[| inputlookup host.csv 
    | table host] index="toto" sourcetype="winhostmon" Type=Service Name=SplunkForwarder 
| eval timenow =now() 
| eval EventCreatedTime=_time 
| eval DiffInSeconds = (timenow - EventCreatedTime) 
| eval Status=if(DiffInSeconds<900, "Online", "Offline") 
| convert timeformat="%d-%b-%Y %H:%M:%S %p %Z" ctime(EventCreatedTime) 
| table host EventCreatedTime DiffInMinutes Status 
| sort +EventCreatedTime 
| dedup host 
| eval Code = if(like(Status,"Online"), "Online", "Offline") 
| stats dc(host) AS OnlineCount by Code 
| fields OnlineCount 
| appendpipe 
    [ stats count 
    | where count=0]
Tags (1)
0 Karma
1 Solution

koshyk
Super Champion

So in your search you do the calcuation of volume% and count somehow

But if you want to display in single Panel, the trick is to concatenate it into a single string. Sample below

|makeresults
| eval volume="25%"
| eval count=10
| eval display_value="volume:"+volume+" count:"+count
| table display_value

You may need to use (field) instead of table may be in the last line in dashboards.

View solution in original post

0 Karma

koshyk
Super Champion

So in your search you do the calcuation of volume% and count somehow

But if you want to display in single Panel, the trick is to concatenate it into a single string. Sample below

|makeresults
| eval volume="25%"
| eval count=10
| eval display_value="volume:"+volume+" count:"+count
| table display_value

You may need to use (field) instead of table may be in the last line in dashboards.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...