<?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: Compare two search results in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-search-that-compares-errors-in-results-from-two/m-p/518095#M145707</link>
    <description>&lt;P&gt;Simplistically, you could use both indexes and search for all errors, count the number of times they occur and just keep them where the count is 1&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=dev OR index=prod "error"
| rex "(?&amp;lt;error&amp;gt;some match to extract your error into a field)"
| stats count by error
| where count = 1&lt;/LI-CODE&gt;</description>
    <pubDate>Sun, 06 Sep 2020 10:17:14 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2020-09-06T10:17:14Z</dc:date>
    <item>
      <title>How to run a search that compares errors in results from two different indexes?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-search-that-compares-errors-in-results-from-two/m-p/518063#M145696</link>
      <description>&lt;P&gt;I have two searches below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=dev 'error' &lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;index=prod 'error'&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to run the above searches together for the same time period and find the unique errors present in search results for 1st query and&amp;nbsp; NOT in the second query and vice-versa.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Sep 2020 17:13:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-search-that-compares-errors-in-results-from-two/m-p/518063#M145696</guid>
      <dc:creator>raj11</dc:creator>
      <dc:date>2020-09-07T17:13:00Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two search results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-search-that-compares-errors-in-results-from-two/m-p/518095#M145707</link>
      <description>&lt;P&gt;Simplistically, you could use both indexes and search for all errors, count the number of times they occur and just keep them where the count is 1&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=dev OR index=prod "error"
| rex "(?&amp;lt;error&amp;gt;some match to extract your error into a field)"
| stats count by error
| where count = 1&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 06 Sep 2020 10:17:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-search-that-compares-errors-in-results-from-two/m-p/518095#M145707</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-09-06T10:17:14Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two search results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-search-that-compares-errors-in-results-from-two/m-p/518111#M145712</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp; for the reply. The developers are looking for a unique list of errors in the below format. For example: Suppose below are the results for two queries (unique errors are Italic)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;index=prod "errors"&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1.error in apple&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. error in banana&lt;/P&gt;&lt;P&gt;&lt;EM&gt;3. error in orange&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;4. error in orange&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;5. error in apple&amp;nbsp;&lt;/P&gt;&lt;P&gt;6. error in banana&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;index=dev "errors"&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1.error in apple&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. error in banana&lt;/P&gt;&lt;P&gt;&lt;EM&gt;3. error in kiwi&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;4. error in kiwi&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;5. error in watermelon&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;6. error in apple&amp;nbsp;&lt;/P&gt;&lt;P&gt;7. error in banana&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The query results should look like below:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Unique errors in Prod:&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;error pattern&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;count&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;error in orange&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Unique errors in Dev:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;error pattern&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;count&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;error in kiwi&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&lt;/P&gt;&lt;P&gt;error in watermelon&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;</description>
      <pubDate>Sun, 06 Sep 2020 15:10:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-search-that-compares-errors-in-results-from-two/m-p/518111#M145712</guid>
      <dc:creator>raj11</dc:creator>
      <dc:date>2020-09-06T15:10:06Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two search results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-search-that-compares-errors-in-results-from-two/m-p/518112#M145713</link>
      <description>&lt;P&gt;OK so you first need to work out which errors occur in each environment then count them&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=dev OR index=prod "error"
| rex "(?&amp;lt;error&amp;gt;some match to extract your error into a field)"
| stats values(error) as error by index
| stats values(index) as index, count by error
| where count = 1&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 06 Sep 2020 15:20:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-search-that-compares-errors-in-results-from-two/m-p/518112#M145713</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-09-06T15:20:50Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two search results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-search-that-compares-errors-in-results-from-two/m-p/518116#M145714</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225859"&gt;@raj11&lt;/a&gt;&amp;nbsp;try the following:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index IN ("dev","prod") "error"        
| stats count(eval(searchmatch("error"))) as ErrorCount by index&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Alternatively, if you know how error values in your raw data is segmented you can also check out the &lt;STRONG&gt;PREFIX directive with tstats (available in Splunk 8.0.0 onward)&lt;/STRONG&gt;. As you would know tstats will run much faster.&lt;/P&gt;&lt;P&gt;Refer to the documentation:&amp;nbsp; &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Tstats#Usage" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Tstats#Usage&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Or following Clara-fication blog on Search Best Practices:&amp;nbsp;&lt;A href="https://www.splunk.com/en_us/blog/tips-and-tricks/splunk-clara-fication-search-best-practices.html" target="_blank"&gt;https://www.splunk.com/en_us/blog/tips-and-tricks/splunk-clara-fication-search-best-practices.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 06 Sep 2020 17:03:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-search-that-compares-errors-in-results-from-two/m-p/518116#M145714</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2020-09-06T17:03:07Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two search results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-search-that-compares-errors-in-results-from-two/m-p/518226#M145743</link>
      <description>&lt;P&gt;Thank you for the reply!! In the example above I do not want all the error count in both indexes.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The error count is needed for unique errors&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Get all the errors for a time period for both indexes&lt;/P&gt;&lt;P&gt;2. Compare results for both indexes and display&lt;/P&gt;&lt;P&gt;&amp;nbsp;a. Unique error count for unique errors in index 1 and NOT in index 2&lt;/P&gt;&lt;P&gt;&amp;nbsp;b. Unique&amp;nbsp;error count for unique errors in index 2 and NOT in index 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Sep 2020 13:02:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-search-that-compares-errors-in-results-from-two/m-p/518226#M145743</guid>
      <dc:creator>raj11</dc:creator>
      <dc:date>2020-09-07T13:02:05Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two search results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-search-that-compares-errors-in-results-from-two/m-p/518263#M145751</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/201110"&gt;@niketn&lt;/a&gt;&amp;nbsp;Thank you for your reply. I am new to splunk so please help!&amp;nbsp;&amp;nbsp;In the above query how can i exclude the sourcetype 'warn' to exclude warnings ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also I need to dynamically consider the error patterns and the since I do not know what the new error pattern would be, I am only looking for "ERROR" for now.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Sep 2020 14:59:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-search-that-compares-errors-in-results-from-two/m-p/518263#M145751</guid>
      <dc:creator>raj11</dc:creator>
      <dc:date>2020-09-07T14:59:56Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two search results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-search-that-compares-errors-in-results-from-two/m-p/518268#M145752</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225859"&gt;@raj11&lt;/a&gt;&amp;nbsp;please try the following&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index IN ("Prod","Dev")  AND "error in"
| rex "error in (?&amp;lt;Error_Component&amp;gt;.*)"
| stats values(index) as index count by "Error_Component"
| search index IN ("Dev","Prod") NOT (index=Dev AND index=Prod)
| sort - index&lt;/LI-CODE&gt;&lt;P&gt;Following is a run anywhere example based on the sample Data and details provided&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| fields - _time
| eval index="Prod",data="error in apple;error in banana;error in orange;error in orange;error in apple;error in banana" 
| makemv data delim=";" 
| mvexpand data 
| append 
    [| makeresults
    | fields - _time
    | eval index="Dev",data="error in apple;error in banana;error in kiwi;error in kiwi;error in watermelon;error in apple;error in banana" 
    | makemv data delim=";"
    | mvexpand data]
| rename data as _raw
| search index IN ("Prod","Dev")  AND "error in"
| rex "error in (?&amp;lt;Error_Component&amp;gt;.*)"
| stats values(index) as index count by "Error_Component"
| search index IN ("Dev","Prod") NOT (index=Dev AND index=Prod)
| sort - index&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the above does not work, in order for the community to assist you better&lt;/P&gt;&lt;P&gt;1. Please add more details like some sample events which you can mock/anonymize as per sensitivity of data.&lt;/P&gt;&lt;P&gt;2. Please provide the solution you have tried and where do you think you are failing.&lt;/P&gt;&lt;P&gt;3. What kind of events are we talking about? Are these custom 3rd party tools or from standard known technology?&lt;BR /&gt;&lt;BR /&gt;4. If this is custom log, any reason why field extraction is not in place? Is the raw text event or of standard format like csv/tsv or any other auto-discover data for automatic field extraction?&lt;/P&gt;</description>
      <pubDate>Mon, 07 Sep 2020 15:26:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-search-that-compares-errors-in-results-from-two/m-p/518268#M145752</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2020-09-07T15:26:16Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two search results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-search-that-compares-errors-in-results-from-two/m-p/518601#M145915</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225859"&gt;@raj11&lt;/a&gt;&amp;nbsp;just use&amp;nbsp;&lt;SPAN&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;sourcetype!='warn'&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Also if you are new to Splunk I would recommend you to go through Splunk Fundamentals courses on Splunk Education.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://www.splunk.com/en_us/training/courses/splunk-fundamentals-1.html" target="_self"&gt;Fundamentals 1&lt;/A&gt; is free for everyone. Fundamentals 2 should be free if you are working for Splunk Partner and your splunk login account uses partner domain in the email address (not personal email).&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 06:18:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-search-that-compares-errors-in-results-from-two/m-p/518601#M145915</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2020-09-09T06:18:47Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two search results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-search-that-compares-errors-in-results-from-two/m-p/518925#M146066</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/201110"&gt;@niketn&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Thank you for your inputs on this. I have tried excluding the warnings using the above and still did not get the desired result. I think the issue is with the requirement itself. The developers are asking to just look for ERROR logs using the key word "error" and not a pattern. All the errors are being listed with the query but the challenge is to categorize those errors as unique. For example an exception like below:&amp;nbsp;&lt;/P&gt;&lt;DIV class="SourceLine SourceLineHL"&gt;&lt;PRE&gt;[2020-09-10 16:46:08.696 GMT] ERROR ShopAPIServlet|1070221786|/servlet/s/Sites-Site/dw/shop/v19_3/orders/2300010101/payment_instruments custom.OCAPI [] OCAPI:{"orderNumber":"2300010101","orderStatus":"NEW","orderSource":"APP"}&lt;/PRE&gt;&lt;/DIV&gt;&lt;DIV class="SourceLine"&gt;&lt;PRE&gt;[2020-09-10 16:44:11.182 GMT] ERROR ShopAPIServlet|225074421|/servlet/s/Sites-Site/dw/shop/v19_3/orders/23053842/payment_instruments custom.OCAPI [] OCAPI:{"orderNumber":"23053842","orderStatus":"NEW","orderSource":"APP"}&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;With just ERROR splunk categorizes these exceptions as unique as I am not ignoring the order number for example....which is expected.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since they are trying to extract the new error patterns without knowing the what the new patterns would be it ..I am finding it hard to suggest a solution.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2020 17:18:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-search-that-compares-errors-in-results-from-two/m-p/518925#M146066</guid>
      <dc:creator>raj11</dc:creator>
      <dc:date>2020-09-10T17:18:08Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two search results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-search-that-compares-errors-in-results-from-two/m-p/518960#M146103</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225859"&gt;@raj11&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You are right "&lt;SPAN&gt;the issue is with the requirement itself." What constitutes uniqueness in these entries?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;[2020-09-10 16:46:08.696 GMT]&lt;/FONT&gt; &lt;FONT color="#33CCCC"&gt;ERROR ShopAPIServlet&lt;/FONT&gt;|&lt;FONT color="#0000FF"&gt;1070221786&lt;/FONT&gt;|&lt;FONT color="#FF00FF"&gt;/servlet/s/Sites-Site/dw/shop/v19_3/orders/&lt;/FONT&gt;2300010101&lt;FONT color="#FF00FF"&gt;/payment_instruments&lt;/FONT&gt; &lt;FONT color="#00FF00"&gt;custom.OCAPI&lt;/FONT&gt; [] OCAPI:{"orderNumber":"2300010101","orderStatus":"NEW","orderSource":"APP"}&lt;/P&gt;&lt;P&gt;All these different coloured parts might be useful parts to be taken into account when determining what a unique error class is. Some more useful than others, e.g. &lt;FONT color="#FF0000"&gt;time&lt;/FONT&gt; and &lt;FONT color="#0000FF"&gt;order number&lt;/FONT&gt; are probably not useful , whereas &lt;FONT color="#33CCCC"&gt;servlet&lt;/FONT&gt; or &lt;FONT color="#FF00FF"&gt;parts of the url&lt;/FONT&gt;&amp;nbsp; or&lt;FONT color="#00FF00"&gt; class&lt;/FONT&gt;(?) might be. You probably need to clarify this before proceeding.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2020 21:33:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-search-that-compares-errors-in-results-from-two/m-p/518960#M146103</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-09-10T21:33:35Z</dc:date>
    </item>
  </channel>
</rss>

