<?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: savedsearch internal parameter in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/savedsearch-internal-parameter/m-p/431887#M28459</link>
    <description>&lt;P&gt;Okay, I execute the following search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults | eval trigger=0|eval decision=if(trigger==1,[|savedsearch rtedump_trigger_on_BWP_hosts|eval t=sourcetype|return $t],0)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and my savedsearch rtedump_trigger_on_BWP_hosts looks as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults

 |rename comment AS " *********************************** Set the list of hosts ***********************************************  "
 | eval master1 ="ls5920", 
        slave11 ="ls5921", 
        slave12 ="ls5922",
        slave13 ="ls5923", 
        slave14 ="ls5924",      
        master2 ="ls5925", 
        slave21 ="ls5926", 
        slave22 ="ls5927",
        slave23 ="ls5928", 
        slave24 ="ls5929"        
 | table [|makeresults |  eval search ="master1 slave11 slave12 slave13 slave14 master2 slave21 slave22 slave23 slave24" | table search ] 
 | transpose 
 | rename "row 1" AS host_to_trigger 
 | table host_to_trigger



 |rename comment AS " *********************************** Start rtedump triggering  *********************************************  "

 | eval triggertime = strftime(now(),"%H:%M")
 | table host_to_trigger triggertime   

 | map maxsearches=20 search="dbxquery query=\"call SYS.MANAGEMENT_CONSOLE_PROC('runtimedump dump -f /usr/sap/BWP/HDB02/$$host_to_trigger$$/trace/DB_BWP/iAlerting_rtedump_ANOMALY_$$triggertime$$.trc','$$host_to_trigger$$:30240',?)\" connection=\"HANA_MLBSO_BWP\" "

 |rename comment AS " *********************************** End rtedump triggering  ************************************************  "
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So, as you see I added the additional $ around the savedsearch parameters. These are set in the savedsearch itself and I do not want to pass them from the first search.&lt;BR /&gt;
... Unfortunately now the result is, that the savedsearch gets executed, so the additional $ did the trick, ... but it should not, because the trigger is set to 0 with the first eval. Also I am getting the error:&lt;/P&gt;

&lt;P&gt;Error in 'eval' command: The expression is malformed. An unexpected character is reached at ',0)'.&lt;/P&gt;

&lt;P&gt;Somehow I do not understand it. Why the savedsearch gets executed at all?&lt;BR /&gt;
And why the error?&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 01:38:06 GMT</pubDate>
    <dc:creator>damucka</dc:creator>
    <dc:date>2020-09-30T01:38:06Z</dc:date>
    <item>
      <title>savedsearch internal parameter</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/savedsearch-internal-parameter/m-p/431885#M28457</link>
      <description>&lt;P&gt;I have quite a complicated search that I shifted into the savedsearch.&lt;BR /&gt;
In this savedsearch I have some parameters, let us say $param1 - but these are "internal" parameters of the savedsearch, not the ones passed from the outside to it.&lt;/P&gt;

&lt;P&gt;Now, when I call my savedsearch from another search, I get of course an error that the $param1 is not passed during the call.&lt;/P&gt;

&lt;P&gt;How would I overcome this?&lt;/P&gt;

&lt;P&gt;Kind Regards,&lt;BR /&gt;
Kamil&lt;/P&gt;</description>
      <pubDate>Sat, 03 Aug 2019 08:00:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/savedsearch-internal-parameter/m-p/431885#M28457</guid>
      <dc:creator>damucka</dc:creator>
      <dc:date>2019-08-03T08:00:59Z</dc:date>
    </item>
    <item>
      <title>Re: savedsearch internal parameter</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/savedsearch-internal-parameter/m-p/431886#M28458</link>
      <description>&lt;P&gt;Could you paste an example.&lt;/P&gt;

&lt;P&gt;I'm not really sure of the problem you're facing. One way to differentiate between different levels of parameters is by using $$param$$ instead of $param$.&lt;/P&gt;</description>
      <pubDate>Sat, 03 Aug 2019 13:50:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/savedsearch-internal-parameter/m-p/431886#M28458</guid>
      <dc:creator>arjunpkishore5</dc:creator>
      <dc:date>2019-08-03T13:50:57Z</dc:date>
    </item>
    <item>
      <title>Re: savedsearch internal parameter</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/savedsearch-internal-parameter/m-p/431887#M28459</link>
      <description>&lt;P&gt;Okay, I execute the following search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults | eval trigger=0|eval decision=if(trigger==1,[|savedsearch rtedump_trigger_on_BWP_hosts|eval t=sourcetype|return $t],0)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and my savedsearch rtedump_trigger_on_BWP_hosts looks as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults

 |rename comment AS " *********************************** Set the list of hosts ***********************************************  "
 | eval master1 ="ls5920", 
        slave11 ="ls5921", 
        slave12 ="ls5922",
        slave13 ="ls5923", 
        slave14 ="ls5924",      
        master2 ="ls5925", 
        slave21 ="ls5926", 
        slave22 ="ls5927",
        slave23 ="ls5928", 
        slave24 ="ls5929"        
 | table [|makeresults |  eval search ="master1 slave11 slave12 slave13 slave14 master2 slave21 slave22 slave23 slave24" | table search ] 
 | transpose 
 | rename "row 1" AS host_to_trigger 
 | table host_to_trigger



 |rename comment AS " *********************************** Start rtedump triggering  *********************************************  "

 | eval triggertime = strftime(now(),"%H:%M")
 | table host_to_trigger triggertime   

 | map maxsearches=20 search="dbxquery query=\"call SYS.MANAGEMENT_CONSOLE_PROC('runtimedump dump -f /usr/sap/BWP/HDB02/$$host_to_trigger$$/trace/DB_BWP/iAlerting_rtedump_ANOMALY_$$triggertime$$.trc','$$host_to_trigger$$:30240',?)\" connection=\"HANA_MLBSO_BWP\" "

 |rename comment AS " *********************************** End rtedump triggering  ************************************************  "
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So, as you see I added the additional $ around the savedsearch parameters. These are set in the savedsearch itself and I do not want to pass them from the first search.&lt;BR /&gt;
... Unfortunately now the result is, that the savedsearch gets executed, so the additional $ did the trick, ... but it should not, because the trigger is set to 0 with the first eval. Also I am getting the error:&lt;/P&gt;

&lt;P&gt;Error in 'eval' command: The expression is malformed. An unexpected character is reached at ',0)'.&lt;/P&gt;

&lt;P&gt;Somehow I do not understand it. Why the savedsearch gets executed at all?&lt;BR /&gt;
And why the error?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:38:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/savedsearch-internal-parameter/m-p/431887#M28459</guid>
      <dc:creator>damucka</dc:creator>
      <dc:date>2020-09-30T01:38:06Z</dc:date>
    </item>
    <item>
      <title>Re: savedsearch internal parameter</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/savedsearch-internal-parameter/m-p/431888#M28460</link>
      <description>&lt;P&gt;The saved_search is getting executed regardless. I'm guessing you do not want the saved_search to execute if trigger is set to 1. For that, pass a variable to  the saved search similar to this&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;&lt;BR /&gt;
 |makeresults &lt;BR /&gt;
| eval trigger=0&lt;BR /&gt;
| map [|savedsearch rtedump_trigger_on_BWP_hosts($trigger$)|table sourcetype]&lt;BR /&gt;
| eval decision=coalesce(sourcetype, 0)&lt;BR /&gt;
&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:38:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/savedsearch-internal-parameter/m-p/431888#M28460</guid>
      <dc:creator>arjunpkishore5</dc:creator>
      <dc:date>2020-09-30T01:38:13Z</dc:date>
    </item>
    <item>
      <title>Re: savedsearch internal parameter</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/savedsearch-internal-parameter/m-p/431889#M28461</link>
      <description>&lt;P&gt;In your saved search&lt;/P&gt;

&lt;P&gt;`&lt;BR /&gt;
|makeresults&lt;BR /&gt;
|where 1==$trigger$&lt;/P&gt;

&lt;P&gt;` &lt;/P&gt;</description>
      <pubDate>Sun, 04 Aug 2019 16:01:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/savedsearch-internal-parameter/m-p/431889#M28461</guid>
      <dc:creator>arjunpkishore5</dc:creator>
      <dc:date>2019-08-04T16:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: savedsearch internal parameter</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/savedsearch-internal-parameter/m-p/431890#M28462</link>
      <description>&lt;P&gt;Unfortunately not.&lt;BR /&gt;
The savedsearch still gets executed, despite of the where statement at the beginning. Isnt the where only for the result filtering?&lt;BR /&gt;
Additionally I am getting the error now:&lt;/P&gt;

&lt;P&gt;Error in 'map': Did not find value for required attribute 'host_to_trigger'.&lt;/P&gt;

&lt;P&gt;Kind Regards,&lt;BR /&gt;
Kamil&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:38:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/savedsearch-internal-parameter/m-p/431890#M28462</guid>
      <dc:creator>damucka</dc:creator>
      <dc:date>2020-09-30T01:38:21Z</dc:date>
    </item>
  </channel>
</rss>

