<?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 Results From Two Searches in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Compare-Results-From-Two-Searches/m-p/247602#M73862</link>
    <description>&lt;P&gt;Hi @javiergn, thank you for coming back to me.&lt;/P&gt;

&lt;P&gt;My solution was the same as your solution no.2&lt;/P&gt;

&lt;P&gt;But as I say, unfortunately this isn't working.&lt;/P&gt;

&lt;P&gt;The end result should be:&lt;/P&gt;

&lt;P&gt;Column 1 = content of 'rest' query which has 227 rows. &lt;BR /&gt;
Column 2 = content if 'eventcount' query which has 38 rows&lt;/P&gt;

&lt;P&gt;So when they are put together there should be blank rows in column 2.&lt;/P&gt;

&lt;P&gt;I hope this helps.&lt;/P&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;</description>
    <pubDate>Fri, 14 Oct 2016 13:48:35 GMT</pubDate>
    <dc:creator>IRHM73</dc:creator>
    <dc:date>2016-10-14T13:48:35Z</dc:date>
    <item>
      <title>Compare Results From Two Searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-Results-From-Two-Searches/m-p/247598#M73858</link>
      <description>&lt;P&gt;Hi, I wonder whether someone may be able to help me please.&lt;/P&gt;

&lt;P&gt;I'm using the following subqueries:&lt;/P&gt;

&lt;P&gt;The first extracts a list of macros that have been created.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rest /servicesNS/-/-/admin/macros count=0 splunk_server=local
| where isnull(args)
| where like(definition, "%index=dg_%")
| rex field=definition "auditSource\=(?&amp;lt;source&amp;gt;[^\s]+)\)"
| rex field=title "(?&amp;lt;indexorig&amp;gt;[^\s]+)_"
| eval index="dg_" .indexorig
| fields source index
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The second provides me with a list of indexes that have been created.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eventcount summarize=false index="dg_*"
| dedup index
| fields index
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What I'm trying to do is create a query which joins via the "index" fields, but produces a list of 'sources' in the first column (first subquery), and then 'indexes' in the second (second subquery.&lt;/P&gt;

&lt;P&gt;Comparing the two, I'm expecting gaps in the index column.&lt;/P&gt;

&lt;P&gt;I've tries using the 'append, 'join', 'appendcols' commands, but so far I've been unable to get this to work.&lt;/P&gt;

&lt;P&gt;I just wondered whether someone could look at this please and offer some guidance on how I may achieve this.&lt;/P&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2016 11:46:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-Results-From-Two-Searches/m-p/247598#M73858</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2016-10-14T11:46:13Z</dc:date>
    </item>
    <item>
      <title>Re: Compare Results From Two Searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-Results-From-Two-Searches/m-p/247599#M73859</link>
      <description>&lt;P&gt;Can you share your "join" search?  I'm not able to replicate exactly what you're doing but I was able to get this to work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rest /servicesNS/-/-/admin/macros | rex field=definition "index=(?&amp;lt;index&amp;gt;\w+)" | search index=* | fields index | join index [ | makeresults count=1 | eval index="_audit" | eval test="test" | fields index test]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It's similar in that both searches start with a data generating command.  So it technically should have worked for you if you followed the correct syntax.  &lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2016 13:18:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-Results-From-Two-Searches/m-p/247599#M73859</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2016-10-14T13:18:53Z</dc:date>
    </item>
    <item>
      <title>Re: Compare Results From Two Searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-Results-From-Two-Searches/m-p/247600#M73860</link>
      <description>&lt;P&gt;You can use join for this but remember no right join is available so you have two options depending on what you are trying to display:&lt;/P&gt;

&lt;P&gt;1)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rest /servicesNS/-/-/admin/macros count=0 splunk_server=local
| where isnull(args)
| where like(definition, "%index=dg_%")
| rex field=definition "auditSource\=(?&amp;lt;source&amp;gt;[^\s]+)\)"
| rex field=title "(?&amp;lt;indexorig&amp;gt;[^\s]+)_"
| eval index="dg_" .indexorig
| fields source index
| join type=left index [
    | eventcount summarize=false index="dg_*"
    | dedup index
    | fields index
]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;2)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eventcount summarize=false index="dg_*"
| dedup index
| fields index
| join type=left index [
    | rest /servicesNS/-/-/admin/macros count=0 splunk_server=local
    | where isnull(args)
    | where like(definition, "%index=dg_%")
    | rex field=definition "auditSource\=(?&amp;lt;source&amp;gt;[^\s]+)\)"
    | rex field=title "(?&amp;lt;indexorig&amp;gt;[^\s]+)_"
    | eval index="dg_" .indexorig
    | fields source index
]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Actually, three if all you care are those cases where index is present in both:&lt;/P&gt;

&lt;P&gt;3)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rest /servicesNS/-/-/admin/macros count=0 splunk_server=local
| where isnull(args)
| where like(definition, "%index=dg_%")
| rex field=definition "auditSource\=(?&amp;lt;source&amp;gt;[^\s]+)\)"
| rex field=title "(?&amp;lt;indexorig&amp;gt;[^\s]+)_"
| eval index="dg_" .indexorig
| fields source index
| join index [
    | eventcount summarize=false index="dg_*"
    | dedup index
    | fields index
]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If none of them work for you please post the query you are running so that we can help you debugging the problem.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
J&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2016 13:32:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-Results-From-Two-Searches/m-p/247600#M73860</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-10-14T13:32:30Z</dc:date>
    </item>
    <item>
      <title>Re: Compare Results From Two Searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-Results-From-Two-Searches/m-p/247601#M73861</link>
      <description>&lt;P&gt;Hi @jkat54, thank you for taking the time to come back to me with this.&lt;/P&gt;

&lt;P&gt;My join query is as below and indeed matches one of the solutions provided by @javiergn.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | eventcount summarize=false index="dg_*"
 | dedup index
 | fields index
 | join type=left index [
     | rest /servicesNS/-/-/admin/macros count=0 splunk_server=local
     | where isnull(args)
     | where like(definition, "%index=dg_%")
     | rex field=definition "auditSource\=(?&amp;lt;source&amp;gt;[^\s]+)\)"
     | rex field=title "(?&amp;lt;indexorig&amp;gt;[^\s]+)_"
     | eval index="dg_" .indexorig
     | fields source index
 ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But as I say, unfortunately this isn't working.&lt;/P&gt;

&lt;P&gt;The end result should be:&lt;/P&gt;

&lt;P&gt;Column 1 = content of 'rest' query which has 227 rows. &lt;BR /&gt;
Column 2 = content if 'eventcount' query which has 38 rows&lt;/P&gt;

&lt;P&gt;So when they are put together there should be blank rows in column 2.&lt;/P&gt;

&lt;P&gt;Does this make sense.&lt;/P&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2016 13:46:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-Results-From-Two-Searches/m-p/247601#M73861</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2016-10-14T13:46:48Z</dc:date>
    </item>
    <item>
      <title>Re: Compare Results From Two Searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-Results-From-Two-Searches/m-p/247602#M73862</link>
      <description>&lt;P&gt;Hi @javiergn, thank you for coming back to me.&lt;/P&gt;

&lt;P&gt;My solution was the same as your solution no.2&lt;/P&gt;

&lt;P&gt;But as I say, unfortunately this isn't working.&lt;/P&gt;

&lt;P&gt;The end result should be:&lt;/P&gt;

&lt;P&gt;Column 1 = content of 'rest' query which has 227 rows. &lt;BR /&gt;
Column 2 = content if 'eventcount' query which has 38 rows&lt;/P&gt;

&lt;P&gt;So when they are put together there should be blank rows in column 2.&lt;/P&gt;

&lt;P&gt;I hope this helps.&lt;/P&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2016 13:48:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-Results-From-Two-Searches/m-p/247602#M73862</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2016-10-14T13:48:35Z</dc:date>
    </item>
    <item>
      <title>Re: Compare Results From Two Searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-Results-From-Two-Searches/m-p/247603#M73863</link>
      <description>&lt;P&gt;Given what you are saying you are looking for a left join where your left table is is the rest query and not the other way around. That is, solution 1 above. Unless I am not understanding your request.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2016 14:25:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-Results-From-Two-Searches/m-p/247603#M73863</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-10-14T14:25:06Z</dc:date>
    </item>
    <item>
      <title>Re: Compare Results From Two Searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-Results-From-Two-Searches/m-p/247604#M73864</link>
      <description>&lt;P&gt;This is the way I replicated your request. Look at the values of index_left and index_right if you want to understand what I'm talking about:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rest /servicesNS/-/-/admin/macros count=0 splunk_server=local
| where isnull(args)
| where like(definition, "%index=%")
| rex field=definition "index=(?&amp;lt;index&amp;gt;\S+)"
| eval index_left = index
| eval source=title
| fields source index index_left
| join type=left index [
    | eventcount summarize=false index="*"
    | dedup index
    | eval index_right = index
    | fields index index_right
]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And this is the output:&lt;/P&gt;

&lt;P&gt;&lt;IMG src="http://i.imgur.com/XEt3zbk.png" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:25:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-Results-From-Two-Searches/m-p/247604#M73864</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2020-09-29T11:25:44Z</dc:date>
    </item>
    <item>
      <title>Re: Compare Results From Two Searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-Results-From-Two-Searches/m-p/247605#M73865</link>
      <description>&lt;P&gt;Give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rest /servicesNS/-/-/admin/macros count=0 splunk_server=local
 | where isnull(args)
 | where like(definition, "%index=dg_%")
 | rex field=definition "auditSource\=(?&amp;lt;source&amp;gt;[^\s]+)\)"
 | rex field=title "(?&amp;lt;indexorig&amp;gt;[^\s]+)_"
 | eval index="dg_" .indexorig
 | table source index
 | join type=left index [
     | eventcount summarize=false index="dg_*"
     | dedup index
     | table index | eval iCreated="Y"]
 | eval index=if(iCreated="Y",index,null())
 | table source index
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Oct 2016 14:41:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-Results-From-Two-Searches/m-p/247605#M73865</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-10-14T14:41:32Z</dc:date>
    </item>
    <item>
      <title>Re: Compare Results From Two Searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-Results-From-Two-Searches/m-p/247606#M73866</link>
      <description>&lt;P&gt;Hi @somesoni2, this works brilliantly. Thank you for taking the time to reply to my post with a solution.&lt;/P&gt;

&lt;P&gt;Kind Regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Sat, 15 Oct 2016 14:42:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-Results-From-Two-Searches/m-p/247606#M73866</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2016-10-15T14:42:51Z</dc:date>
    </item>
    <item>
      <title>Re: Compare Results From Two Searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-Results-From-Two-Searches/m-p/247607#M73867</link>
      <description>&lt;P&gt;Hi @javiergn, thank you for taking the time to come back to me with this. Please see the working solution from @somesoni2.&lt;/P&gt;

&lt;P&gt;Kind Regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Sat, 15 Oct 2016 14:44:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-Results-From-Two-Searches/m-p/247607#M73867</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2016-10-15T14:44:18Z</dc:date>
    </item>
  </channel>
</rss>

