<?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: not able to merge 2 queries to get the desired result in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/not-able-to-merge-2-queries-to-get-the-desired-result/m-p/547570#M155278</link>
    <description>&lt;P&gt;I guess there are a couple of things to try. Firstly, depending on your searches, you may or may not use double quotes around index names, so trim those. Secondly, again depending on your searches, you may be searching more than one index, so use max_match=0. Finally, title is returned by saved/searches so you should probably override that with the index name found.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rest /services/data/indexes
| fields title
| dedup title
| append [
| rest /servicesNS/-/-/saved/searches
| rex field=search max_match=0 "index=(?P&amp;lt;searchindex&amp;gt;[^\s]+)"
| eval title=trim(searchindex,"\"")
| stats count by title
]
| stats values(*) as * by title
| where isnull(count)&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 12 Apr 2021 09:40:17 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2021-04-12T09:40:17Z</dc:date>
    <item>
      <title>not able to merge 2 queries to get the desired result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/not-able-to-merge-2-queries-to-get-the-desired-result/m-p/546816#M155016</link>
      <description>&lt;P&gt;I have 2 queries&lt;/P&gt;&lt;P&gt;1st is&amp;nbsp;&lt;/P&gt;&lt;P&gt;| rest /services/data/indexes&lt;BR /&gt;| fields title&lt;BR /&gt;| dedup title&lt;BR /&gt;| table title&lt;/P&gt;&lt;P&gt;this query is giving me all the indexes in my environment&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2nd query is&lt;/P&gt;&lt;P&gt;| rest /servicesNS/-/-/saved/searches&lt;BR /&gt;| rex field=search "index=(?P&amp;lt;title&amp;gt;[^ ]+)"&lt;BR /&gt;| stats count by title&lt;BR /&gt;| sort -count&lt;BR /&gt;| table title&lt;/P&gt;&lt;P&gt;this is giving me all the indexes on which any savedsearch is created.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now i want to see the remove the 2nd query set from 1st and just wanted to see the indexes on which there are no savedsearches in the environment.&lt;/P&gt;&lt;P&gt;I have tried placing "NOT" between the queries but not able to get the desired result.&lt;/P&gt;&lt;P&gt;Please help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Apr 2021 08:26:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/not-able-to-merge-2-queries-to-get-the-desired-result/m-p/546816#M155016</guid>
      <dc:creator>vinitpathri</dc:creator>
      <dc:date>2021-04-06T08:26:22Z</dc:date>
    </item>
    <item>
      <title>Re: not able to merge 2 queries to get the desired result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/not-able-to-merge-2-queries-to-get-the-desired-result/m-p/546819#M155017</link>
      <description>&lt;LI-CODE lang="markup"&gt;| rest /services/data/indexes
| fields title
| dedup title
| append [
| rest /servicesNS/-/-/saved/searches
| rex field=search "index=(?P&amp;lt;title&amp;gt;[^ ]+)"
| stats count by title
]
| stats values(*) as * by title
| where isnull(count)&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 06 Apr 2021 08:36:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/not-able-to-merge-2-queries-to-get-the-desired-result/m-p/546819#M155017</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-04-06T08:36:28Z</dc:date>
    </item>
    <item>
      <title>Re: not able to merge 2 queries to get the desired result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/not-able-to-merge-2-queries-to-get-the-desired-result/m-p/547565#M155276</link>
      <description>&lt;P&gt;Thanks for your quick reply but the above query is not giving the exact required result (i am getting few of the indexes/feeds on which there is no savedsearch but not all)&lt;/P&gt;</description>
      <pubDate>Mon, 12 Apr 2021 08:42:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/not-able-to-merge-2-queries-to-get-the-desired-result/m-p/547565#M155276</guid>
      <dc:creator>vinitpathri</dc:creator>
      <dc:date>2021-04-12T08:42:02Z</dc:date>
    </item>
    <item>
      <title>Re: not able to merge 2 queries to get the desired result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/not-able-to-merge-2-queries-to-get-the-desired-result/m-p/547567#M155277</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/57545"&gt;@vinitpathri&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Your first query outputs titles event rex does not match, please try below, I filtered internal indexes and also index=* searches;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rest /services/data/indexes 
| fields title 
| dedup title 
| search title!="_*" 
| table title 
| search NOT 
    [| rest /servicesNS/-/-/saved/searches 
    | rex field=search "index=(?P&amp;lt;searched_index&amp;gt;[^ ]+)" 
    | where isnotnull(searched_index) AND searched_index!="_*" 
    | fields searched_index 
    | rename searched_index as title 
    | dedup title 
    | regex title="[^\*]" ]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Apr 2021 08:58:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/not-able-to-merge-2-queries-to-get-the-desired-result/m-p/547567#M155277</guid>
      <dc:creator>scelikok</dc:creator>
      <dc:date>2021-04-12T08:58:08Z</dc:date>
    </item>
    <item>
      <title>Re: not able to merge 2 queries to get the desired result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/not-able-to-merge-2-queries-to-get-the-desired-result/m-p/547570#M155278</link>
      <description>&lt;P&gt;I guess there are a couple of things to try. Firstly, depending on your searches, you may or may not use double quotes around index names, so trim those. Secondly, again depending on your searches, you may be searching more than one index, so use max_match=0. Finally, title is returned by saved/searches so you should probably override that with the index name found.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rest /services/data/indexes
| fields title
| dedup title
| append [
| rest /servicesNS/-/-/saved/searches
| rex field=search max_match=0 "index=(?P&amp;lt;searchindex&amp;gt;[^\s]+)"
| eval title=trim(searchindex,"\"")
| stats count by title
]
| stats values(*) as * by title
| where isnull(count)&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 12 Apr 2021 09:40:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/not-able-to-merge-2-queries-to-get-the-desired-result/m-p/547570#M155278</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-04-12T09:40:17Z</dc:date>
    </item>
  </channel>
</rss>

