<?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: How do i search non matching values from two different indexes and display in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-i-search-non-matching-values-from-two-different-indexes/m-p/300300#M164968</link>
    <description>&lt;P&gt;There was an typo on the 2nd query, fixed, should work now.&lt;/P&gt;

&lt;P&gt;Provided an updated query for Q1 for updated requirement. Check that as well.&lt;/P&gt;</description>
    <pubDate>Tue, 21 Nov 2017 19:47:18 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2017-11-21T19:47:18Z</dc:date>
    <item>
      <title>How do i search non matching values from two different indexes and display</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-i-search-non-matching-values-from-two-different-indexes/m-p/300291#M164959</link>
      <description>&lt;P&gt;This is what I am doing &lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt; extract value until the first occurrence of char &amp;amp;  using the search string&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;index="prod_clean" | rex field=_raw "\?pyActivity=(?([^&amp;amp;]+))" | stats count AS "Count" by PA | table "PA" "Count"&lt;BR /&gt;
index="mod_clean" | rex field=_raw "\?pyActivity=(?([^&amp;amp;]+))" | stats count AS "Count" by PA | table "PA" "Count"&lt;/P&gt;

&lt;P&gt;My log  sample:&lt;/P&gt;

&lt;P&gt;?pyActivity=FinishAssig&amp;amp;pzPrimaryPageName=pyWorkPage&amp;amp;pzTransactionId=xxxxx&amp;amp;pzFromFrame=pyWorkPage HTTP/1.1" 200 1383&lt;/P&gt;

&lt;P&gt;?pyActivity=Sh-Harness&amp;amp;Purpose=Perform&amp;amp;SkipFrame=true&amp;amp;TaskIndex=1&amp;amp;HarnessMode=ACTION&amp;amp;TaskValue=CAIXXXr_____CA&amp;amp;TaskHTML=CAXXXℜadOnly=-1&amp;amp;FrameName=pyWorkPage&amp;amp;pzPrimaryPageName=pyWorkPage HTTP/1.1" 200 14547&lt;/P&gt;

&lt;P&gt;?pyActivity=Data-Por.Get&amp;amp;IsBMLogin=true∈StandardsMode=false&amp;amp;AJAXTrackID=1&amp;amp;pzHarnessID=HIDXXXXHTTP/1.1" 200 10&lt;/P&gt;

&lt;P&gt;Sample expected output for both indexes:&lt;/P&gt;

&lt;H2&gt;PA                                       Count&lt;/H2&gt;

&lt;P&gt;FinishAssig                             1&lt;BR /&gt;
Sh-Harness                            1&lt;BR /&gt;
Data-Por.Get                          1&lt;/P&gt;

&lt;P&gt;since I have two indexes  index="prod_clean"  AND  index="mod_clean" &lt;/P&gt;

&lt;P&gt;Q1.How do I write the search to get non matching values from two indexes and display in a table ?&lt;BR /&gt;
Q2. How do I write the search to get only matching values and there count in each index?&lt;/P&gt;

&lt;P&gt;I tried Q2 but I know it is not correct it is getting the total count instead of individual ? and also suggest for Q1.&lt;/P&gt;

&lt;P&gt;index="prod_clean" OR index="mod_clean" | rex field=_raw "PreActivity=(?([^&amp;amp;]+))" | eval matchID=coalesce(PA,PA)&lt;BR /&gt;
| stats values(*) as * by matchID | stats count AS "Count" by matchID | table "matchID" "Count"&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:54:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-i-search-non-matching-values-from-two-different-indexes/m-p/300291#M164959</guid>
      <dc:creator>saifullakhalid</dc:creator>
      <dc:date>2020-09-29T16:54:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do i search non matching values from two different indexes and display</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-i-search-non-matching-values-from-two-different-indexes/m-p/300292#M164960</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;

&lt;P&gt;you should use the code formatting for SPL and regex to keep all the special characters, code formatting can be applied by selecting the text and press either CTRL-K or the &lt;CODE&gt;101010&lt;/CODE&gt; button. &lt;BR /&gt;
This helps people to be able to help because they can see all of your SPL and regex.&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2017 18:29:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-i-search-non-matching-values-from-two-different-indexes/m-p/300292#M164960</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2017-11-21T18:29:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do i search non matching values from two different indexes and display</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-i-search-non-matching-values-from-two-different-indexes/m-p/300293#M164961</link>
      <description>&lt;P&gt;Can you be more specific in your question?  it's not very clear what you are trying to accomplish.  Are you trying to count the number of times you see &lt;STRONG&gt;FinishAssig&lt;/STRONG&gt;, &lt;STRONG&gt;Sh-Harness&lt;/STRONG&gt;, and &lt;STRONG&gt;Data-Por.Get&lt;/STRONG&gt; ?  I am not sure what you are getting by using coalesce on the same field (PA &amp;amp; PA).  That is not what is intended for coalesce.  Can you explain your question a bit more?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index="prod_clean" OR index="mod_clean")
| rex field=_raw "=(?&amp;lt;CAPTURE&amp;gt;[^&amp;amp;]+)"
| eval matchID=coalesce(PA,PA)
| stats count by index CAPTURE matchID
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Nov 2017 18:34:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-i-search-non-matching-values-from-two-different-indexes/m-p/300293#M164961</guid>
      <dc:creator>DEAD_BEEF</dc:creator>
      <dc:date>2017-11-21T18:34:24Z</dc:date>
    </item>
    <item>
      <title>Re: How do i search non matching values from two different indexes and display</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-i-search-non-matching-values-from-two-different-indexes/m-p/300294#M164962</link>
      <description>&lt;P&gt;Q1.How do I write the search to get non matching values from two indexes and display in a table ?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="prod_clean" OR index="mod_clean" | rex field=_raw "\?pyActivity=(?&amp;lt;PA&amp;gt;([^&amp;amp;]+))" 
| stats count AS "Count" dc(index) as reportedIn values(index) as Index by PA 
| where reportedIn=1 
| table PA Count Index
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Update&lt;/STRONG&gt; If you only looking for PA's present in  prod_clean but not in mod_clean, try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="prod_clean" OR index="mod_clean" | rex field=_raw "\?pyActivity=(?&amp;lt;PA&amp;gt;([^&amp;amp;]+))" 
| stats count AS "Count" dc(index) as reportedIn values(index) as Index by PA 
| where reportedIn=1 AND Index="prod_clean"
| table PA Count Index
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Q2. How do I write the search to get only matching values and there count in each index?&lt;BR /&gt;
&lt;STRONG&gt;Fixed typo&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="prod_clean" OR index="mod_clean" | rex field=_raw "\?pyActivity=(?&amp;lt;PA&amp;gt;([^&amp;amp;]+))" 
| stats count AS "Count" by PA index
| eventstats dc(index) as reportedIn by PA 
| where reportedIn=2
| chart sum(Count) as Count over PA by index
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:55:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-i-search-non-matching-values-from-two-different-indexes/m-p/300294#M164962</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-09-29T16:55:02Z</dc:date>
    </item>
    <item>
      <title>Re: How do i search non matching values from two different indexes and display</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-i-search-non-matching-values-from-two-different-indexes/m-p/300295#M164963</link>
      <description>&lt;P&gt;Your solutions are always so clean.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2017 18:43:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-i-search-non-matching-values-from-two-different-indexes/m-p/300295#M164963</guid>
      <dc:creator>DEAD_BEEF</dc:creator>
      <dc:date>2017-11-21T18:43:55Z</dc:date>
    </item>
    <item>
      <title>Re: How do i search non matching values from two different indexes and display</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-i-search-non-matching-values-from-two-different-indexes/m-p/300296#M164964</link>
      <description>&lt;P&gt;I have 2 access logs of same format inserted into 2 different indexes ( &lt;CODE&gt;index="prod_clean" AND index="mod_clean"&lt;/CODE&gt; )&lt;/P&gt;

&lt;P&gt;I need to pull URL  and there execution count .&lt;BR /&gt;
From the log sample below I need to extract URL starting from &lt;CODE&gt;?proactivity=&lt;/CODE&gt; &lt;BR /&gt;
For which I am using the search query as below.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="prod_clean" | rex field=_raw "\?pyActivity=(?&amp;lt;PA&amp;gt;([^&amp;amp;]+))" | stats count AS "Count" by PA | table "PA" "Count"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;index="mod_clean" | rex field=_raw "\?pyActivity=(?([^&amp;amp;]+))" | stats count AS "Count" by PA | table "PA" "Count"&lt;/P&gt;

&lt;P&gt;The above is done separately , so I wanted to write a single query to get matching URLs from both indexes and there individual execution counts.&lt;/P&gt;

&lt;P&gt;Also same for non matching which is present in index &lt;CODE&gt;prod_clean&lt;/CODE&gt; but not present in &lt;CODE&gt;'mod_clean'&lt;/CODE&gt; and its count.&lt;/P&gt;

&lt;P&gt;My full log sample is here :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;1x.xx.xxx.xxx - - 11xxxxx4 [03/Oct/2017:08:01:54 -0400] - /pxxx/Gxxxxt/uxxxxxxxxx4[/!TABTHREAD1 HTTP/1.1 oxxx-xxx.xxx.net TIME:0/123717 "POST /pxxxb/Gxxxxt/uxxxxxxxxxxxxxxxxx4%5B/!TABTHREAD1?prActivity=Cxxxxxxxxx-xxxx.xxxxxx%20ℜquest_Type=&amp;amp;xxxxxTYPE_CD=COUNTRY&amp;amp;Exxxxxxxx_CD=⟪uageCode=&amp;amp;CountryCode=&amp;amp;PRODUCT_LINE_CD=®ION_CD=&amp;amp;LOB=&amp;amp;LOB_SUB_CD=&amp;amp;Count= HTTP/1.1" 200 4011


1x.xx.xxx.xxx - - - [03/Oct/2017:08:01:54 -0400] - /pddddb/Gdddd/xxxxxxxxxxxxxxxxxx[/themeimages/h1expand_theme_ccddd.gif!!.gif HTTP/1.1 oxxxxxxxxxxx.aig.net TIME:0/12758 "GET / /pddddb/Gdddd/xxxxxxxxxxxxxxxxxx[/themeimages/h1expand_theme_ccddd.gif!!.gif HTTP/1.1" 200 69

1x.xx.xxx.xxx- - 1ssssss4 [03/Oct/2017:08:02:09 -0400] - /pxxxx/Gxxxxxt/uxxxxxxxxxxxxxxxxx4[/!TABTHREAD1 HTTP/1.1 oxxx-xxx.xx.net TIME:0/117091 "POST /pxxxb/Gxxxt/xxxxxxxxxxxxxxxxxxxxB/!TABTHREAD1?prActivity=ReloadSection&amp;amp;pzIxxxd=xxxxxxxxxxxxxxxxxxx&amp;amp;pzFromFrame=pyxxxx&amp;amp;pzxxxxxxxxxxxe=pyxxxxxxxxe&amp;amp;pzxxxxxxx=false&amp;amp;StreamName=AddPropertyDetails&amp;amp;BaseReference=xxxxxxxxxx.xxxxxxxxxxe.Prxxxxxxx&amp;amp;Stxxxxxxxxxxxss=xxxxxxx-Section&amp;amp;bClientValidation=true&amp;amp;FieldError=ERRORTEXT⪻eActivity=&amp;amp;xxxxxxxxxge=true&amp;amp;HexxxxxxxxnName=SubxxxxxxorkObjectHeaderB∈StandardsMode=true&amp;amp;AJAXTrackID=5&amp;amp;pzHarnessID=HIDxxxxxxxxx HTTP/1.1" 200 4512
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:55:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-i-search-non-matching-values-from-two-different-indexes/m-p/300296#M164964</guid>
      <dc:creator>saifullakhalid</dc:creator>
      <dc:date>2020-09-29T16:55:05Z</dc:date>
    </item>
    <item>
      <title>Re: How do i search non matching values from two different indexes and display</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-i-search-non-matching-values-from-two-different-indexes/m-p/300297#M164965</link>
      <description>&lt;P&gt;I have started using CTRL+K now. thanks&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2017 18:53:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-i-search-non-matching-values-from-two-different-indexes/m-p/300297#M164965</guid>
      <dc:creator>saifullakhalid</dc:creator>
      <dc:date>2017-11-21T18:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: How do i search non matching values from two different indexes and display</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-i-search-non-matching-values-from-two-different-indexes/m-p/300298#M164966</link>
      <description>&lt;P&gt;Q1: This should get  values which is present in index prod_clean but not present in 'mod_clean' and its count.&lt;BR /&gt;
When I run the above Q1 search I get both index values and there count.&lt;/P&gt;

&lt;P&gt;Q2:  This search gives &lt;CODE&gt;No results found&lt;/CODE&gt;. but I see some matching records when search manually in both indexes.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:55:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-i-search-non-matching-values-from-two-different-indexes/m-p/300298#M164966</guid>
      <dc:creator>saifullakhalid</dc:creator>
      <dc:date>2020-09-29T16:55:08Z</dc:date>
    </item>
    <item>
      <title>Re: How do i search non matching values from two different indexes and display</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-i-search-non-matching-values-from-two-different-indexes/m-p/300299#M164967</link>
      <description>&lt;P&gt;I see now.  You want two queries:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;Query 1 will give you a table of statistics showing the index, url (PA) when PA was present in mod index BUT NOT in index prod and vice versa (present in prod BUT NOT index mod)&lt;/LI&gt;
&lt;LI&gt;Query 2 will give you the a table of statistics formatted as  index, url (PA) when the PA is present in BOTH indexes (mod &amp;amp; prod)&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;Do I understand correctly now?&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2017 19:37:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-i-search-non-matching-values-from-two-different-indexes/m-p/300299#M164967</guid>
      <dc:creator>DEAD_BEEF</dc:creator>
      <dc:date>2017-11-21T19:37:15Z</dc:date>
    </item>
    <item>
      <title>Re: How do i search non matching values from two different indexes and display</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-i-search-non-matching-values-from-two-different-indexes/m-p/300300#M164968</link>
      <description>&lt;P&gt;There was an typo on the 2nd query, fixed, should work now.&lt;/P&gt;

&lt;P&gt;Provided an updated query for Q1 for updated requirement. Check that as well.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2017 19:47:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-i-search-non-matching-values-from-two-different-indexes/m-p/300300#M164968</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-11-21T19:47:18Z</dc:date>
    </item>
    <item>
      <title>Re: How do i search non matching values from two different indexes and display</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-i-search-non-matching-values-from-two-different-indexes/m-p/300301#M164969</link>
      <description>&lt;P&gt;It works perfectly thanks&lt;BR /&gt;
But I think my rex has a issue though.&lt;/P&gt;

&lt;P&gt;Though all the line in code has char  &lt;CODE&gt;&amp;amp;&lt;/CODE&gt; ,  but there are few line like below and due to this it consider entire line starting from &lt;CODE&gt;pyActivity=&lt;/CODE&gt; as unique. so even there is match in mod it consider as unique.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;?pyActivity=CXXXXXs-FW-XXXXXX HTTP/1.1" 200 549
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Nov 2017 20:25:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-i-search-non-matching-values-from-two-different-indexes/m-p/300301#M164969</guid>
      <dc:creator>saifullakhalid</dc:creator>
      <dc:date>2017-11-21T20:25:02Z</dc:date>
    </item>
    <item>
      <title>Re: How do i search non matching values from two different indexes and display</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-i-search-non-matching-values-from-two-different-indexes/m-p/300302#M164970</link>
      <description>&lt;P&gt;I see.  Change your regex so that it &lt;STRONG&gt;MUST&lt;/STRONG&gt; match between the &lt;CODE&gt;=&lt;/CODE&gt; and the &lt;CODE&gt;&amp;amp;&lt;/CODE&gt; sign.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=_raw "\?pyActivity=((?&amp;lt;PA&amp;gt;[^&amp;amp;].*?)(?=&amp;amp;))"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Nov 2017 21:13:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-i-search-non-matching-values-from-two-different-indexes/m-p/300302#M164970</guid>
      <dc:creator>DEAD_BEEF</dc:creator>
      <dc:date>2017-11-21T21:13:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do i search non matching values from two different indexes and display</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-i-search-non-matching-values-from-two-different-indexes/m-p/300303#M164971</link>
      <description>&lt;P&gt;Try this for your regex&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=_raw "\?pyActivity=(?&amp;lt;PA&amp;gt;[^&amp;amp;\s\"]+)" 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Nov 2017 21:15:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-i-search-non-matching-values-from-two-different-indexes/m-p/300303#M164971</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-11-21T21:15:41Z</dc:date>
    </item>
  </channel>
</rss>

