<?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: Can we pass a parameter to a report? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Can-we-pass-a-parameter-to-a-report/m-p/757553#M243188</link>
    <description>&lt;P&gt;&lt;STRONG&gt;YES&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Assuming the &lt;EM&gt;search&lt;/EM&gt; was saved with an SPL including a token, like &lt;FONT face="courier new,courier"&gt;$myvar$&lt;/FONT&gt;, you can call the report (aka saved search) in SPL with that syntax:&lt;FONT face="courier new,courier"&gt; | savedsearch myreport myvar=1000&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Example:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;| makeresults count=10 &lt;/FONT&gt;-&amp;gt; generates 10 stats events&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;| makeresults count=$myvar$&lt;/FONT&gt; -&amp;gt; saved as a report named &lt;EM&gt;myreport&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;| savedsearch myreport myvar=1000&lt;/FONT&gt; -&amp;gt; will run the saved search for 1000 events&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Note:&amp;nbsp;&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;If you omit to name the expected variable when calling the saved search, you'd end up with an error. The report now expects the variable(s) to be mentioned an any run.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;You can call then the saved search in CLI from the Search Head (or locally to an indexer):&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;/opt/splunk/bin/splunk search '| savedsearch myreport myvar=10'&lt;/LI-CODE&gt;
&lt;P&gt;or from a REST call:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;curl -u user:password -k https://&amp;lt;api_server&amp;gt;:8089/servicesNS/nobody/&amp;lt;app_name&amp;gt;/search/jobs -d "search=savedsearch myreport myvar=1000" -d exec_mode=oneshot&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;You can also use the saved search from a Dashboard, at least from XML.&lt;/P&gt;</description>
    <pubDate>Fri, 23 Jan 2026 14:33:00 GMT</pubDate>
    <dc:creator>ldongradi_SPL</dc:creator>
    <dc:date>2026-01-23T14:33:00Z</dc:date>
    <item>
      <title>Can we pass a parameter to a report?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-we-pass-a-parameter-to-a-report/m-p/642410#M222536</link>
      <description>&lt;P&gt;Is there a way to pass a parameter to a report when calling it via -&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;curl -u user:password -k https://&amp;lt;api_server&amp;gt;:8089/servicesNS/nobody/&amp;lt;app_name&amp;gt;/search/jobs -d "search=savedsearch &amp;lt;savedsearch_name&amp;gt;" -d exec_mode=oneshot -d count=10000&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2023 15:30:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-we-pass-a-parameter-to-a-report/m-p/642410#M222536</guid>
      <dc:creator>danielbb</dc:creator>
      <dc:date>2023-05-05T15:30:52Z</dc:date>
    </item>
    <item>
      <title>Re: Can we pass a parameter to a report?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-we-pass-a-parameter-to-a-report/m-p/642463#M222552</link>
      <description>&lt;P&gt;Depending on what you want to pass - or, in an awkward way to say it, &lt;U&gt;where&lt;/U&gt; you want to pass into. &amp;nbsp;You cannot change SPL in a saved search when calling it. &amp;nbsp;There are limited ways to influence the output by passing CGI variables in GET method. &amp;nbsp;The most obvious, and arguably the most useful one is earliest and latest. To do so, you will need to save with Time Range Picker "Yes"; and the SPL in the saved search must not have override to earliest and latest.&lt;/P&gt;</description>
      <pubDate>Sat, 06 May 2023 05:49:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-we-pass-a-parameter-to-a-report/m-p/642463#M222552</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-05-06T05:49:54Z</dc:date>
    </item>
    <item>
      <title>Re: Can we pass a parameter to a report?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-we-pass-a-parameter-to-a-report/m-p/757553#M243188</link>
      <description>&lt;P&gt;&lt;STRONG&gt;YES&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Assuming the &lt;EM&gt;search&lt;/EM&gt; was saved with an SPL including a token, like &lt;FONT face="courier new,courier"&gt;$myvar$&lt;/FONT&gt;, you can call the report (aka saved search) in SPL with that syntax:&lt;FONT face="courier new,courier"&gt; | savedsearch myreport myvar=1000&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Example:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;| makeresults count=10 &lt;/FONT&gt;-&amp;gt; generates 10 stats events&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;| makeresults count=$myvar$&lt;/FONT&gt; -&amp;gt; saved as a report named &lt;EM&gt;myreport&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;| savedsearch myreport myvar=1000&lt;/FONT&gt; -&amp;gt; will run the saved search for 1000 events&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Note:&amp;nbsp;&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;If you omit to name the expected variable when calling the saved search, you'd end up with an error. The report now expects the variable(s) to be mentioned an any run.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;You can call then the saved search in CLI from the Search Head (or locally to an indexer):&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;/opt/splunk/bin/splunk search '| savedsearch myreport myvar=10'&lt;/LI-CODE&gt;
&lt;P&gt;or from a REST call:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;curl -u user:password -k https://&amp;lt;api_server&amp;gt;:8089/servicesNS/nobody/&amp;lt;app_name&amp;gt;/search/jobs -d "search=savedsearch myreport myvar=1000" -d exec_mode=oneshot&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;You can also use the saved search from a Dashboard, at least from XML.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jan 2026 14:33:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-we-pass-a-parameter-to-a-report/m-p/757553#M243188</guid>
      <dc:creator>ldongradi_SPL</dc:creator>
      <dc:date>2026-01-23T14:33:00Z</dc:date>
    </item>
    <item>
      <title>Re: Can we pass a parameter to a report?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-we-pass-a-parameter-to-a-report/m-p/757579#M243190</link>
      <description>&lt;P&gt;This is very useful information! &amp;nbsp;Meanwhile, Splunk equates "saved search" with "Report". &amp;nbsp;If you save a search with token, the saved search can no longer be used as Report because the common sense of a Report is such that you open it and see output. &amp;nbsp;In such use, the "saved search" is very much just another way of saving a macro.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jan 2026 06:19:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-we-pass-a-parameter-to-a-report/m-p/757579#M243190</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2026-01-23T06:19:05Z</dc:date>
    </item>
  </channel>
</rss>

