<?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 Evaluating dynamically generated field name in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Evaluating-dynamically-generated-field-name/m-p/333682#M163355</link>
    <description>&lt;P&gt;I've an event where some field "values" can be concatenated/evaluated to generate a field "name" that exists in the same event. I want to evaluate the generated field name to get its value.&lt;/P&gt;

&lt;P&gt;A simple query to imitate this is below. How do I evaluate "foo" so that I get the value "johndoe"  (ie "foo" is a reference/pointer to the user)&lt;BR /&gt;
| stats count | eval user="johndoe" | eval foo="user" &lt;/P&gt;</description>
    <pubDate>Thu, 25 Jan 2018 00:35:04 GMT</pubDate>
    <dc:creator>hsingams2</dc:creator>
    <dc:date>2018-01-25T00:35:04Z</dc:date>
    <item>
      <title>Evaluating dynamically generated field name</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Evaluating-dynamically-generated-field-name/m-p/333682#M163355</link>
      <description>&lt;P&gt;I've an event where some field "values" can be concatenated/evaluated to generate a field "name" that exists in the same event. I want to evaluate the generated field name to get its value.&lt;/P&gt;

&lt;P&gt;A simple query to imitate this is below. How do I evaluate "foo" so that I get the value "johndoe"  (ie "foo" is a reference/pointer to the user)&lt;BR /&gt;
| stats count | eval user="johndoe" | eval foo="user" &lt;/P&gt;</description>
      <pubDate>Thu, 25 Jan 2018 00:35:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Evaluating-dynamically-generated-field-name/m-p/333682#M163355</guid>
      <dc:creator>hsingams2</dc:creator>
      <dc:date>2018-01-25T00:35:04Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluating dynamically generated field name</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Evaluating-dynamically-generated-field-name/m-p/333683#M163356</link>
      <description>&lt;P&gt;Hi hsingams2,&lt;/P&gt;

&lt;P&gt;almost got it right &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | makeresults | eval user="johndoe" | eval foo="user" | eval foo2=user
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;by using &lt;CODE&gt;""&lt;/CODE&gt; around the user you tell &lt;CODE&gt;eval&lt;/CODE&gt; to use user as a string, and by not using &lt;CODE&gt;""&lt;/CODE&gt; around user you tell &lt;CODE&gt;eval&lt;/CODE&gt; to refer to another field called &lt;CODE&gt;user&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Does that make sense?&lt;/P&gt;

&lt;P&gt;Hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jan 2018 00:59:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Evaluating-dynamically-generated-field-name/m-p/333683#M163356</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2018-01-25T00:59:50Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluating dynamically generated field name</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Evaluating-dynamically-generated-field-name/m-p/333684#M163357</link>
      <description>&lt;P&gt;Thanks for the response. I understand that the calling without quotes would work.&lt;BR /&gt;
The only issue is I can't use the user field directly. It has to be referenced through foo (i.e foo -&amp;gt; user -&amp;gt; johndoe)&lt;/P&gt;

&lt;P&gt;My real life case is something similar to this:&lt;BR /&gt;
... | eval foo=mvindex(split(somefield,"\n"),1)."/STATUS" &lt;/P&gt;

&lt;P&gt;As you can see the "foo" here is dynamically generated and contains a field name as a string value (eg. "TEST00123/STATUS") that I want to evaluate.&lt;/P&gt;

&lt;P&gt;Hope it makes sense.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jan 2018 01:53:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Evaluating-dynamically-generated-field-name/m-p/333684#M163357</guid>
      <dc:creator>hsingams2</dc:creator>
      <dc:date>2018-01-25T01:53:14Z</dc:date>
    </item>
  </channel>
</rss>

