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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...