<?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 to dispatch a saved search with parameters using the Javascript SDK in Reporting</title>
    <link>https://community.splunk.com/t5/Reporting/How-to-dispatch-a-saved-search-with-parameters-using-the/m-p/65464#M1512</link>
    <description>&lt;P&gt;Agreed. We have this documented for our &lt;A href="http://dev.splunk.com/view/SP-CAAAEKY#runsavedargs"&gt;Java&lt;/A&gt; and &lt;A href="http://dev.splunk.com/view/SP-CAAAEQF#runsavedargs"&gt;C#&lt;/A&gt; SDKs but we need to port this information into other SDKs as well.&lt;/P&gt;</description>
    <pubDate>Wed, 19 Jun 2013 15:54:03 GMT</pubDate>
    <dc:creator>Neeraj_Luthra</dc:creator>
    <dc:date>2013-06-19T15:54:03Z</dc:date>
    <item>
      <title>How to dispatch a saved search with parameters using the Javascript SDK</title>
      <link>https://community.splunk.com/t5/Reporting/How-to-dispatch-a-saved-search-with-parameters-using-the/m-p/65461#M1509</link>
      <description>&lt;P&gt;If I dispatch a saved search with no parameters (like $IP$, $HOST$, $username$, etc), it runs properly and returns result, but for some reason when dispatching a search &lt;STRONG&gt;with&lt;/STRONG&gt; parameters, I get no rows in the result.&lt;/P&gt;

&lt;P&gt;Here's how I'm sending the search with params:&lt;/P&gt;

&lt;P&gt;mySavedSearch.dispatch({ "dispatch.IP": "192.168.0.1" }, function(err, job) { ... }&lt;/P&gt;

&lt;P&gt;I got this from the SavedSearch documentation:&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/DocumentationStatic/JavaScriptSDK/1.1/splunkjs.Service.SavedSearch.html#splunkjs.Service.SavedSearch-dispatch"&gt;http://docs.splunk.com/DocumentationStatic/JavaScriptSDK/1.1/splunkjs.Service.SavedSearch.html#splunkjs.Service.SavedSearch-dispatch&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Can anyone advise me how to run a saved search with the Javascript SDK, with parameters?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;BR /&gt;
Yossi.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2013 15:23:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/How-to-dispatch-a-saved-search-with-parameters-using-the/m-p/65461#M1509</guid>
      <dc:creator>yoxigen</dc:creator>
      <dc:date>2013-06-17T15:23:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to dispatch a saved search with parameters using the Javascript SDK</title>
      <link>https://community.splunk.com/t5/Reporting/How-to-dispatch-a-saved-search-with-parameters-using-the/m-p/65462#M1510</link>
      <description>&lt;P&gt;There are a few dispatch specific arguments you can pass like &lt;CODE&gt;bucket&lt;/CODE&gt;, &lt;CODE&gt;max_count&lt;/CODE&gt;, &lt;CODE&gt;earliest_time&lt;/CODE&gt; etc. You can get the full list at &lt;A href="http://docs.splunk.com/Documentation/Splunk/5.0.3/admin/savedsearchesconf"&gt;savedsearches.conf&lt;/A&gt;.&lt;/P&gt;

&lt;P&gt;The parameters that you are trying to use are substituted slightly differently. Here is an example ...&lt;/P&gt;

&lt;P&gt;Sample saved search query with &lt;CODE&gt;host&lt;/CODE&gt; as one of the parameters that I want to substitute at runtime: &lt;CODE&gt;&lt;/CODE&gt;&lt;PRE&gt;&lt;CODE&gt;index=fooindex sourcetype=foosourcetype host=$args.host$&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;
Sample JS code to dispatch with argument substitution: &lt;CODE&gt;&lt;/CODE&gt;&lt;PRE&gt;&lt;CODE&gt;mySavedSearch.dispatch({"args.host": "foohost"}, function(err, job) {&lt;BR /&gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;/P&gt;

&lt;P&gt;You can bind multiple parameters in the call above depending on your need. Remember to specify &lt;CODE&gt;args&lt;/CODE&gt; along with your parameter name as mentioned above.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2013 21:51:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/How-to-dispatch-a-saved-search-with-parameters-using-the/m-p/65462#M1510</guid>
      <dc:creator>Neeraj_Luthra</dc:creator>
      <dc:date>2013-06-18T21:51:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to dispatch a saved search with parameters using the Javascript SDK</title>
      <link>https://community.splunk.com/t5/Reporting/How-to-dispatch-a-saved-search-with-parameters-using-the/m-p/65463#M1511</link>
      <description>&lt;P&gt;Thanks Neeraj, this really helps!&lt;/P&gt;

&lt;P&gt;In the Javasript SDK documentation it doesn't say anything about having to specify the saved search parameters as "$args.host" instead of "$host", but that's what I was missing.&lt;/P&gt;

&lt;P&gt;It'd be great for others looking for the same information if an example was added to the Javascript SDK API reference under SavedSearch.dispatch.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2013 07:21:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/How-to-dispatch-a-saved-search-with-parameters-using-the/m-p/65463#M1511</guid>
      <dc:creator>yoxigen</dc:creator>
      <dc:date>2013-06-19T07:21:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to dispatch a saved search with parameters using the Javascript SDK</title>
      <link>https://community.splunk.com/t5/Reporting/How-to-dispatch-a-saved-search-with-parameters-using-the/m-p/65464#M1512</link>
      <description>&lt;P&gt;Agreed. We have this documented for our &lt;A href="http://dev.splunk.com/view/SP-CAAAEKY#runsavedargs"&gt;Java&lt;/A&gt; and &lt;A href="http://dev.splunk.com/view/SP-CAAAEQF#runsavedargs"&gt;C#&lt;/A&gt; SDKs but we need to port this information into other SDKs as well.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2013 15:54:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/How-to-dispatch-a-saved-search-with-parameters-using-the/m-p/65464#M1512</guid>
      <dc:creator>Neeraj_Luthra</dc:creator>
      <dc:date>2013-06-19T15:54:03Z</dc:date>
    </item>
  </channel>
</rss>

