<?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 assign value from another eval param in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/assign-value-from-another-eval-param/m-p/660282#M227924</link>
    <description>&lt;P&gt;How to assign the value of param name original to the source in the | collect statement&lt;BR /&gt;index=123&amp;nbsp;&lt;/P&gt;&lt;P&gt;| eval original=abcd,&lt;/P&gt;&lt;P&gt;&amp;nbsp;| collect index=qaz source=original&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 10 Oct 2023 19:13:48 GMT</pubDate>
    <dc:creator>eranhauser</dc:creator>
    <dc:date>2023-10-10T19:13:48Z</dc:date>
    <item>
      <title>assign value from another eval param</title>
      <link>https://community.splunk.com/t5/Splunk-Search/assign-value-from-another-eval-param/m-p/660282#M227924</link>
      <description>&lt;P&gt;How to assign the value of param name original to the source in the | collect statement&lt;BR /&gt;index=123&amp;nbsp;&lt;/P&gt;&lt;P&gt;| eval original=abcd,&lt;/P&gt;&lt;P&gt;&amp;nbsp;| collect index=qaz source=original&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2023 19:13:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/assign-value-from-another-eval-param/m-p/660282#M227924</guid>
      <dc:creator>eranhauser</dc:creator>
      <dc:date>2023-10-10T19:13:48Z</dc:date>
    </item>
    <item>
      <title>Re: assign value from another eval param</title>
      <link>https://community.splunk.com/t5/Splunk-Search/assign-value-from-another-eval-param/m-p/660283#M227925</link>
      <description>&lt;P&gt;Like with a programming language (writing searches in SPL is a form of programming after all), the order of operations does matter.&lt;/P&gt;&lt;P&gt;So&lt;/P&gt;&lt;PRE&gt;| eval a=b,c=a&lt;/PRE&gt;&lt;P&gt;will yield different results than&lt;/P&gt;&lt;PRE&gt;| eval c=a,a=b&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2023 19:10:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/assign-value-from-another-eval-param/m-p/660283#M227925</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-10-10T19:10:02Z</dc:date>
    </item>
    <item>
      <title>Re: assign value from another eval param</title>
      <link>https://community.splunk.com/t5/Splunk-Search/assign-value-from-another-eval-param/m-p/660284#M227926</link>
      <description>&lt;P&gt;I edited my question. That works in two eval&amp;nbsp; parameters but not on the source parameter in the | collect&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2023 19:14:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/assign-value-from-another-eval-param/m-p/660284#M227926</guid>
      <dc:creator>eranhauser</dc:creator>
      <dc:date>2023-10-10T19:14:46Z</dc:date>
    </item>
    <item>
      <title>Re: assign value from another eval param</title>
      <link>https://community.splunk.com/t5/Splunk-Search/assign-value-from-another-eval-param/m-p/660286#M227927</link>
      <description>&lt;P&gt;No. You can't do that. You need a constant parameter for the collect command. If you want to generate it dynamically, you need to do a subsearch from which you return the value of the parameter (the subsearch is executed before the main search).&lt;/P&gt;&lt;P&gt;Another option is to use the collect command with output_format=hec - then you can specify your metadata fields on a per-event basis but that's more complicated.&lt;/P&gt;&lt;P&gt;See &lt;A href="https://docs.splunk.com/Documentation/Splunk/9.1.1/SearchReference/Collect" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/9.1.1/SearchReference/Collect&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Collect is generally a relatively tricky command with some non-obvious restrictions (and uses your license if you use sourcetype different than the default stash one) so it's worth reading thoroughly the docs about it and test it on a dev environment before trying to run it in prod.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2023 19:20:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/assign-value-from-another-eval-param/m-p/660286#M227927</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-10-10T19:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: assign value from another eval param</title>
      <link>https://community.splunk.com/t5/Splunk-Search/assign-value-from-another-eval-param/m-p/660292#M227928</link>
      <description>&lt;P&gt;Unfortunately it does not work. using sub search will change the query source value but not the collect one&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2023 19:46:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/assign-value-from-another-eval-param/m-p/660292#M227928</guid>
      <dc:creator>eranhauser</dc:creator>
      <dc:date>2023-10-10T19:46:37Z</dc:date>
    </item>
    <item>
      <title>Re: assign value from another eval param</title>
      <link>https://community.splunk.com/t5/Splunk-Search/assign-value-from-another-eval-param/m-p/660718#M228114</link>
      <description>&lt;P&gt;More words please.&lt;/P&gt;&lt;P&gt;Subsearch is getting executed (and its results are substituted) where it's placed. So if you do&lt;/P&gt;&lt;PRE&gt;collect [...] sourcetype=[whatever subsearch you come up with]&lt;/PRE&gt;&lt;P&gt;It will work.&lt;/P&gt;&lt;P&gt;But that will give you one static value for the whole collect command.&lt;/P&gt;&lt;P&gt;If you want to dynamically assign the "destination" sourcetype per each event separately, you must use the hec format.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2023 18:40:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/assign-value-from-another-eval-param/m-p/660718#M228114</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-10-13T18:40:05Z</dc:date>
    </item>
  </channel>
</rss>

