Splunk Search

How to 2 spunk search into one result and substract the sum value of 1 search to another search and display it?

archonixm
New Member

index=oswindows sourcetype="winhost" host=npe OR host=npw source=service earliest="-30d@d" latest="@d DisplayName="Vontu Monitor"
| transaction DisplayName !(startswith="State=Stopped" endswith="State=Running")
| stats sum(duration) as abc1 by host,DisplayName

index=oswindows sourcetype="winhost" host=npe OR host=npw source=service earliest="-30d@d" latest="@d" DisplayName="Vontu Monitor"
| transaction DisplayName startswith="State=Stopped" endswith="State=Running"
| stats sum(duration) as abc2 by host, DisplayName

What I want is to substract the first sum of value by host for first search with second search. Please help me. I tried append and appendcols but it doesn't display the second search result.

0 Karma

kmorris_splunk
Splunk Employee
Splunk Employee

This is a simple example, but give something like this a try:

sourcetype=access_combined action=addtocart 
| stats sum(bytes) as bytes_atc by clientip 
| appendcols 
    [ search sourcetype=access_combined action=purchase 
    | stats sum(bytes) as bytes_purch by clientip] 
| eval sum_all=bytes_atc + bytes_purch
0 Karma

richgalloway
SplunkTrust
SplunkTrust

The two searches are identical except for the as clause so the result will always be zero.
Perhaps you meant to paste a different second search?

---
If this reply helps you, Karma would be appreciated.
0 Karma

archonixm
New Member

one with ! in it...in the transaction command...

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!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...