<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Simple subtraction between two searches in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Simple-subtraction-between-two-searches/m-p/679413#M232268</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/265541"&gt;@Fo&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;please try something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index="first-app" sourcetype="first-app_application_log"  "eventType=IMPORTANT_CREATE_EVENT") OR (index="second-app" sourcetype="second-app_application_log" "eventType=IMPORTANT_CANCEL_EVENT")
| stats
   count(eval(index="first-app")) AS "first_app"
   count(eval(index="second-app")) AS "second_app"
| eval diff="first_app"-"second_app"
| table diff&lt;/LI-CODE&gt;&lt;P&gt;One additional hint: don't use minus char in field names because Splunk knows it as the minus sign, use underscore (_).&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
    <pubDate>Sun, 03 Mar 2024 15:29:40 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2024-03-03T15:29:40Z</dc:date>
    <item>
      <title>Simple subtraction between two searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Simple-subtraction-between-two-searches/m-p/679412#M232267</link>
      <description>&lt;P&gt;I have two very simple searches and I need to be able to get the difference. This is insanely hard for something that is so simple.&amp;nbsp;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;search index="first-app" sourcetype="first-app_application_log"&lt;BR /&gt;AND "eventType=IMPORTANT_CREATE_EVENT" | stats count&lt;/P&gt;&lt;P&gt;^ this result is 150&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;search index="second-app" sourcetype="second-app_application_log"&lt;BR /&gt;AND "eventType=IMPORTANT_CANCEL_EVENT" | stats count&lt;/P&gt;&lt;P&gt;^ this result is 5&lt;/P&gt;&lt;P&gt;I'm trying to figure out how to simply do the 150 - 5 to get 145. I've tried `set diff` `eval` a bunch of different ways with no luck. I'm going nuts.&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated!&lt;/P&gt;</description>
      <pubDate>Sun, 03 Mar 2024 14:54:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Simple-subtraction-between-two-searches/m-p/679412#M232267</guid>
      <dc:creator>Fo</dc:creator>
      <dc:date>2024-03-03T14:54:33Z</dc:date>
    </item>
    <item>
      <title>Re: Simple subtraction between two searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Simple-subtraction-between-two-searches/m-p/679413#M232268</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/265541"&gt;@Fo&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;please try something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index="first-app" sourcetype="first-app_application_log"  "eventType=IMPORTANT_CREATE_EVENT") OR (index="second-app" sourcetype="second-app_application_log" "eventType=IMPORTANT_CANCEL_EVENT")
| stats
   count(eval(index="first-app")) AS "first_app"
   count(eval(index="second-app")) AS "second_app"
| eval diff="first_app"-"second_app"
| table diff&lt;/LI-CODE&gt;&lt;P&gt;One additional hint: don't use minus char in field names because Splunk knows it as the minus sign, use underscore (_).&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Sun, 03 Mar 2024 15:29:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Simple-subtraction-between-two-searches/m-p/679413#M232268</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-03-03T15:29:40Z</dc:date>
    </item>
    <item>
      <title>Re: Simple subtraction between two searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Simple-subtraction-between-two-searches/m-p/679459#M232288</link>
      <description>&lt;P&gt;Correction to&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;'s suggestion - when you quote field names on the righthand side of an evaluation, you need to use single quotes not double quotes (otherwise, Splunk treats them as strings and you can't subtract on string from another as they are not numeric data types)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index="first-app" sourcetype="first-app_application_log"  "eventType=IMPORTANT_CREATE_EVENT") OR (index="second-app" sourcetype="second-app_application_log" "eventType=IMPORTANT_CANCEL_EVENT")
| stats
   count(eval(index="first-app")) AS "first_app"
   count(eval(index="second-app")) AS "second_app"
| eval diff='first_app'-'second_app'
| table diff&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Mar 2024 11:01:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Simple-subtraction-between-two-searches/m-p/679459#M232288</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-03-04T11:01:14Z</dc:date>
    </item>
    <item>
      <title>Re: Simple subtraction between two searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Simple-subtraction-between-two-searches/m-p/679463#M232289</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/265541"&gt;@Fo&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;as hinted by&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;it was a mistyping for this reason I hinted to avoid the minus char!&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index="first-app" sourcetype="first-app_application_log"  "eventType=IMPORTANT_CREATE_EVENT") OR (index="second-app" sourcetype="second-app_application_log" "eventType=IMPORTANT_CANCEL_EVENT")
| stats
   count(eval(index="first-app")) AS "first_app"
   count(eval(index="second-app")) AS "second_app"
| eval diff=first_app-second_app
| table diff&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 04 Mar 2024 11:08:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Simple-subtraction-between-two-searches/m-p/679463#M232289</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-03-04T11:08:45Z</dc:date>
    </item>
  </channel>
</rss>

