<?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 Why is my Splunk REST API Saved Searches Query not handling namespace parameter? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Why-is-my-Splunk-REST-API-Saved-Searches-Query-not-handling/m-p/268473#M16989</link>
    <description>&lt;P&gt;(I am currently using Splunk &lt;CODE&gt;6.3.3&lt;/CODE&gt; if that matters.)&lt;/P&gt;

&lt;P&gt;Looking at the JavaScript documentation andit appears that I should be able to filter saved searches based on owner, app, and sharing.&lt;/P&gt;

&lt;P&gt;I have three saved searches defined in an application:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;&lt;span class="lia-inline-image-display-wrapper"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/1402iA96B18E928F4F5FA/image-size/large?v=v2&amp;amp;px=999" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;However, when I attempt to get only these searches in the JavaScript &amp;amp; REST API, I see a list of globally shared searches for a variety of different applications:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;# Some Javascript...

const splunkConfig = {
  # username, password, etc. for the ohd user
}
const service = new splunkjs.Service(splunkConfig);
const savedSearches = service.savedSearches({owner: "ohd", app: "dev_ohd", sharing: "user"});
savedSearches.fetch(function (err, savedSearches) {
  for (let i = 0; i &amp;lt; savedSearches.list().length; i++) {
    let searchInstance = savedSearches.list()[i];
    console.log(searchInstance.name);
    console.log(searchInstance.namespace);
  }
});
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When run this, the above code prints out the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... # correct owner, wrong app, wrong sharing
ohd_full_scom_data
{ owner: 'ohd', app: 'search', sharing: 'global' }

# correct owner, app, and sharing
...
ohd_aserv_summary
{ owner: 'ohd', app: 'dev_ohd', sharing: 'user' }
ohd_azure_drilldown
{ owner: 'ohd', app: 'dev_ohd', sharing: 'user' }
ohd_azure_summary
{ owner: 'ohd', app: 'dev_ohd', sharing: 'user' }

# wrong owner, app, and sharing
...
ohd_scom_metric_history
{ owner: 'kevwang', app: 'search', sharing: 'global' }
ohd_splunk_usage
{ owner: 'ohd',
  app: 'splunk_management_console',
  sharing: 'global' }
Per-Panel Filtering - Activity By User Over Time
{ owner: 'admin', app: 'SA-Utils', sharing: 'global' }
Per-Panel Filtering - Recent Activity
{ owner: 'admin', app: 'SA-Utils', sharing: 'global' }
Per-Panel Filtering - Top Users
{ owner: 'admin', app: 'SA-Utils', sharing: 'global' }
...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is there something obvious that I am missing? Using the REST API through &lt;EM&gt;splunk_instance_ip&lt;/EM&gt;:8089/servicesNS/ohd/dev_ohd/saved/searches the same problem exists.&lt;/P&gt;</description>
    <pubDate>Tue, 24 May 2016 18:50:17 GMT</pubDate>
    <dc:creator>awwong2</dc:creator>
    <dc:date>2016-05-24T18:50:17Z</dc:date>
    <item>
      <title>Why is my Splunk REST API Saved Searches Query not handling namespace parameter?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Why-is-my-Splunk-REST-API-Saved-Searches-Query-not-handling/m-p/268473#M16989</link>
      <description>&lt;P&gt;(I am currently using Splunk &lt;CODE&gt;6.3.3&lt;/CODE&gt; if that matters.)&lt;/P&gt;

&lt;P&gt;Looking at the JavaScript documentation andit appears that I should be able to filter saved searches based on owner, app, and sharing.&lt;/P&gt;

&lt;P&gt;I have three saved searches defined in an application:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;&lt;span class="lia-inline-image-display-wrapper"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/1402iA96B18E928F4F5FA/image-size/large?v=v2&amp;amp;px=999" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;However, when I attempt to get only these searches in the JavaScript &amp;amp; REST API, I see a list of globally shared searches for a variety of different applications:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;# Some Javascript...

const splunkConfig = {
  # username, password, etc. for the ohd user
}
const service = new splunkjs.Service(splunkConfig);
const savedSearches = service.savedSearches({owner: "ohd", app: "dev_ohd", sharing: "user"});
savedSearches.fetch(function (err, savedSearches) {
  for (let i = 0; i &amp;lt; savedSearches.list().length; i++) {
    let searchInstance = savedSearches.list()[i];
    console.log(searchInstance.name);
    console.log(searchInstance.namespace);
  }
});
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When run this, the above code prints out the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... # correct owner, wrong app, wrong sharing
ohd_full_scom_data
{ owner: 'ohd', app: 'search', sharing: 'global' }

# correct owner, app, and sharing
...
ohd_aserv_summary
{ owner: 'ohd', app: 'dev_ohd', sharing: 'user' }
ohd_azure_drilldown
{ owner: 'ohd', app: 'dev_ohd', sharing: 'user' }
ohd_azure_summary
{ owner: 'ohd', app: 'dev_ohd', sharing: 'user' }

# wrong owner, app, and sharing
...
ohd_scom_metric_history
{ owner: 'kevwang', app: 'search', sharing: 'global' }
ohd_splunk_usage
{ owner: 'ohd',
  app: 'splunk_management_console',
  sharing: 'global' }
Per-Panel Filtering - Activity By User Over Time
{ owner: 'admin', app: 'SA-Utils', sharing: 'global' }
Per-Panel Filtering - Recent Activity
{ owner: 'admin', app: 'SA-Utils', sharing: 'global' }
Per-Panel Filtering - Top Users
{ owner: 'admin', app: 'SA-Utils', sharing: 'global' }
...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is there something obvious that I am missing? Using the REST API through &lt;EM&gt;splunk_instance_ip&lt;/EM&gt;:8089/servicesNS/ohd/dev_ohd/saved/searches the same problem exists.&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2016 18:50:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Why-is-my-Splunk-REST-API-Saved-Searches-Query-not-handling/m-p/268473#M16989</guid>
      <dc:creator>awwong2</dc:creator>
      <dc:date>2016-05-24T18:50:17Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my Splunk REST API Saved Searches Query not handling namespace parameter?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Why-is-my-Splunk-REST-API-Saved-Searches-Query-not-handling/m-p/268474#M16990</link>
      <description>&lt;P&gt;This is the expected behavior.  You're seeing searches that are shared globally, which means they effectively do not have an app context.&lt;/P&gt;

&lt;P&gt;In your screen shot you have "this apps" selected as your filter, if you select "all" you'll see the other searches there as well.&lt;/P&gt;

&lt;P&gt;I think you can use this pagination and filter option to get exactly what you're looking for though:&lt;/P&gt;

&lt;P&gt;request.ui_dispatch_app&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.4.1/RESTREF/RESTprolog#Pagination_and_filtering_parameters" target="_blank"&gt;http://docs.splunk.com/Documentation/Splunk/6.4.1/RESTREF/RESTprolog#Pagination_and_filtering_parameters&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.4.1/RESTREF/RESTsearch#GET_saved.2Fsearches_method_detail" target="_blank"&gt;http://docs.splunk.com/Documentation/Splunk/6.4.1/RESTREF/RESTsearch#GET_saved.2Fsearches_method_detail&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 09:47:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Why-is-my-Splunk-REST-API-Saved-Searches-Query-not-handling/m-p/268474#M16990</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2020-09-29T09:47:09Z</dc:date>
    </item>
  </channel>
</rss>

