<?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: Use Subsearch to insert commands in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Use-Subsearch-to-insert-commands/m-p/666326#M228589</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/258544"&gt;@duesser&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;good for you, see next time!&lt;/P&gt;&lt;P&gt;Ciao and happy splunking&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: Karma Points are appreciated by all the contributors &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 26 Oct 2023 10:41:48 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2023-10-26T10:41:48Z</dc:date>
    <item>
      <title>Use Subsearch to insert commands</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-Subsearch-to-insert-commands/m-p/666295#M228571</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I would like to use a subsearch to literally paste a command into the SPL e.g.:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
[| makeresults
| eval test="|eval t1 = \"hello\""
| return $test]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and for it to be equivalent to&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval t1 = "hello"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this possible?&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2023 09:17:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-Subsearch-to-insert-commands/m-p/666295#M228571</guid>
      <dc:creator>duesser</dc:creator>
      <dc:date>2023-10-26T09:17:29Z</dc:date>
    </item>
    <item>
      <title>Re: Use Subsearch to insert commands</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-Subsearch-to-insert-commands/m-p/666297#M228572</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/258544"&gt;@duesser&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;when you use a subsearch, you run a search on the main search using the output (exactly the fields you have in return or in fields).&lt;/P&gt;&lt;P&gt;What's your requirement?&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2023 08:22:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-Subsearch-to-insert-commands/m-p/666297#M228572</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-10-26T08:22:02Z</dc:date>
    </item>
    <item>
      <title>Re: Use Subsearch to insert commands</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-Subsearch-to-insert-commands/m-p/666301#M228573</link>
      <description>&lt;P&gt;I know that I can do&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=abc
         [
            | makeresults
            | addinfo
            | eval filter_t="earliest=".(info_min_time-60)." latest=".info_max_time
            | return filter_t
         ]&lt;/LI-CODE&gt;&lt;P&gt;which literally becomes&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=abc earliest=1698301592.0 latest=1698301792.0&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;and I would like to use this behavior to dynamically define a command&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2023 08:30:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-Subsearch-to-insert-commands/m-p/666301#M228573</guid>
      <dc:creator>duesser</dc:creator>
      <dc:date>2023-10-26T08:30:46Z</dc:date>
    </item>
    <item>
      <title>Re: Use Subsearch to insert commands</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-Subsearch-to-insert-commands/m-p/666309#M228577</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/258544"&gt;@duesser&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;pleae try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=abc
         [
            | makeresults
            | addinfo
            | eval earliest=relative_time(info_min_time,"-60s"), latest=info_max_time
            | fields earliest latest
         ]&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2023 09:12:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-Subsearch-to-insert-commands/m-p/666309#M228577</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-10-26T09:12:02Z</dc:date>
    </item>
    <item>
      <title>Re: Use Subsearch to insert commands</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-Subsearch-to-insert-commands/m-p/666312#M228579</link>
      <description>&lt;P&gt;I am sorry for the confusion, I updated the original question.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The idea is to dynamically create strings of eval commands in a sub search (depending on a lookup e.g.) and then applying these to the base search by literally putting the into the search command. I hope I could clarify this now.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2023 09:16:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-Subsearch-to-insert-commands/m-p/666312#M228579</guid>
      <dc:creator>duesser</dc:creator>
      <dc:date>2023-10-26T09:16:34Z</dc:date>
    </item>
    <item>
      <title>Re: Use Subsearch to insert commands</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-Subsearch-to-insert-commands/m-p/666314#M228581</link>
      <description>&lt;P&gt;Do a quick test:&lt;/P&gt;&lt;PRE&gt;[ | makeresults | eval search="| makeresults" ]&lt;/PRE&gt;&lt;P&gt;If you look into the job log you'll see that while the internal search will get expanded to&lt;/P&gt;&lt;PRE&gt;Expanded index search = ([ | makeresults | eval search="| makeresults" ])&lt;/PRE&gt;&lt;P&gt;After the subsearch is evaluated and the result is returned to the outer search it will be treated as a string, with the pipe control character escaped&lt;/P&gt;&lt;PRE&gt;Expanded index search = (\| makeresults)&lt;/PRE&gt;&lt;P&gt;Which means that you will be searching for literal pipe character and "makeresults" word.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2023 09:33:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-Subsearch-to-insert-commands/m-p/666314#M228581</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-10-26T09:33:42Z</dc:date>
    </item>
    <item>
      <title>Re: Use Subsearch to insert commands</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-Subsearch-to-insert-commands/m-p/666315#M228582</link>
      <description>&lt;P&gt;Yes I have seen this exactly. But is it possible to work around this in any way?&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2023 09:35:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-Subsearch-to-insert-commands/m-p/666315#M228582</guid>
      <dc:creator>duesser</dc:creator>
      <dc:date>2023-10-26T09:35:48Z</dc:date>
    </item>
    <item>
      <title>Re: Use Subsearch to insert commands</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-Subsearch-to-insert-commands/m-p/666319#M228585</link>
      <description>&lt;P&gt;I should expect not.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PickleRick_0-1698313276886.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/27831i4E5BFE7F27E0D01C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PickleRick_0-1698313276886.png" alt="PickleRick_0-1698313276886.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2023 09:41:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-Subsearch-to-insert-commands/m-p/666319#M228585</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-10-26T09:41:24Z</dc:date>
    </item>
    <item>
      <title>Re: Use Subsearch to insert commands</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-Subsearch-to-insert-commands/m-p/666326#M228589</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/258544"&gt;@duesser&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;good for you, see next time!&lt;/P&gt;&lt;P&gt;Ciao and happy splunking&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: Karma Points are appreciated by all the contributors &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2023 10:41:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-Subsearch-to-insert-commands/m-p/666326#M228589</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-10-26T10:41:48Z</dc:date>
    </item>
  </channel>
</rss>

