Splunk Search

Dashboard

uagraw01
Builder

I want difference between 155 and 132, how can i do with the Spl.

 

IMG_20201103_194436.jpg

Labels (1)
0 Karma
1 Solution

renjith_nair
Legend

Try adding this to your search

Your search
|stats first(eval(if(Week_Status=="this_week",Total_host,null()))) as this,first(eval(if(Week_Status=="last_week",Total_host,null()))) as that
|eval diff=this-that

Run anywhere search

|makeresults|eval Total_host="132 155"|makemv Total_host |mvexpand Total_host|appendcols [|makeresults|eval Week_Status="this_week last_week"|makemv Week_Status| mvexpand Week_Status]
|stats first(eval(if(Week_Status=="this_week",Total_host,null()))) as this,first(eval(if(Week_Status=="last_week",Total_host,null()))) as that
|eval diff=this-that

 

OR

Your search
|eval {Week_Status}=Total_host
|stats values(*) as *
|eval diff=last_week-this_week
|makeresults|eval Total_host="132 155"|makemv Total_host |mvexpand Total_host|appendcols [|makeresults|eval Week_Status="this_week last_week"|makemv Week_Status| mvexpand Week_Status]
|eval {Week_Status}=Total_host
|stats values(*) as *
|eval diff=last_week-this_week

 

Happy Splunking!

View solution in original post

renjith_nair
Legend

Try adding this to your search

Your search
|stats first(eval(if(Week_Status=="this_week",Total_host,null()))) as this,first(eval(if(Week_Status=="last_week",Total_host,null()))) as that
|eval diff=this-that

Run anywhere search

|makeresults|eval Total_host="132 155"|makemv Total_host |mvexpand Total_host|appendcols [|makeresults|eval Week_Status="this_week last_week"|makemv Week_Status| mvexpand Week_Status]
|stats first(eval(if(Week_Status=="this_week",Total_host,null()))) as this,first(eval(if(Week_Status=="last_week",Total_host,null()))) as that
|eval diff=this-that

 

OR

Your search
|eval {Week_Status}=Total_host
|stats values(*) as *
|eval diff=last_week-this_week
|makeresults|eval Total_host="132 155"|makemv Total_host |mvexpand Total_host|appendcols [|makeresults|eval Week_Status="this_week last_week"|makemv Week_Status| mvexpand Week_Status]
|eval {Week_Status}=Total_host
|stats values(*) as *
|eval diff=last_week-this_week

 

Happy Splunking!

uagraw01
Builder

@renjith_nair  Thanks for your response. I need to add list of difference server also in my search how can i add ? Please help

0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...