<?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: How do you treat a variable value as another field with Splunk? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-treat-a-variable-value-as-another-field-with-Splunk/m-p/402245#M173728</link>
    <description>&lt;P&gt;thank you very much. This was what I was looking for. Got my query with some minor modifications on this. &lt;/P&gt;</description>
    <pubDate>Fri, 11 Jan 2019 21:49:26 GMT</pubDate>
    <dc:creator>derekho55</dc:creator>
    <dc:date>2019-01-11T21:49:26Z</dc:date>
    <item>
      <title>How do you treat a variable value as another field with Splunk?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-treat-a-variable-value-as-another-field-with-Splunk/m-p/402240#M173723</link>
      <description>&lt;P&gt;I have a field named "object_XXX_property", where XXX string is dynamically generated and is held in another field named "entity". I want to get at the object property field and have it on a table. I figured that I probably need an intermediate variable to handle the dynamically generated field name:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;code&amp;gt;base search | eval cn="objects_".entity."_property"|.. &amp;lt;/code&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How can I get my cn variable to display the value of the object_property field with Splunk?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 22:44:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-treat-a-variable-value-as-another-field-with-Splunk/m-p/402240#M173723</guid>
      <dc:creator>derekho55</dc:creator>
      <dc:date>2020-09-29T22:44:18Z</dc:date>
    </item>
    <item>
      <title>Re: How do you treat a variable value as another field with Splunk?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-treat-a-variable-value-as-another-field-with-Splunk/m-p/402241#M173724</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/205237"&gt;@derekho55&lt;/a&gt; ,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base search | eval object_{entity}_property="your value"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will create field names with object_abc_property,object_xyz_property etc where abc &amp;amp; xyz are your entity values&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 22:44:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-treat-a-variable-value-as-another-field-with-Splunk/m-p/402241#M173724</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2020-09-29T22:44:45Z</dc:date>
    </item>
    <item>
      <title>Re: How do you treat a variable value as another field with Splunk?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-treat-a-variable-value-as-another-field-with-Splunk/m-p/402242#M173725</link>
      <description>&lt;P&gt;Thanks for your response. I don't want to create a field named object_{entity}_property; it already exists as a field with a value in it that I want to extract. &lt;/P&gt;

&lt;P&gt;I've been trying with &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| eval cn = object_{entity}_property| table cn&lt;/CODE&gt; but it wont work.&lt;/P&gt;

&lt;P&gt;Straight up  &lt;CODE&gt;base search |table object_{entity}_property&lt;/CODE&gt; didn't work either. &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 22:41:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-treat-a-variable-value-as-another-field-with-Splunk/m-p/402242#M173725</guid>
      <dc:creator>derekho55</dc:creator>
      <dc:date>2020-09-29T22:41:40Z</dc:date>
    </item>
    <item>
      <title>Re: How do you treat a variable value as another field with Splunk?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-treat-a-variable-value-as-another-field-with-Splunk/m-p/402243#M173726</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval entity = "foo" 
| eval object_foo_property = "correct"
| eval object_bar_property = "wrong"
| eval object_bat_property = "wrong"

| rename COMMENT AS "Everything above generates sample event data; everything below is your solution"

| eval cn="NO_MATCH"
| foreach object_*_property [ eval cn=if((entity="&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;"), &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;, cn) ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Do note that this also "works" but apparently is not what you desire (because it is the inverse):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval entity = "foo" 

| rename COMMENT AS "Everything above generates sample event data; everything below is your solution"

| eval object_{entity}_property = "bar"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 11 Jan 2019 18:36:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-treat-a-variable-value-as-another-field-with-Splunk/m-p/402243#M173726</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-01-11T18:36:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do you treat a variable value as another field with Splunk?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-treat-a-variable-value-as-another-field-with-Splunk/m-p/402244#M173727</link>
      <description>&lt;P&gt;Now that I "get it", this is a GREAT question.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jan 2019 18:38:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-treat-a-variable-value-as-another-field-with-Splunk/m-p/402244#M173727</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-01-11T18:38:27Z</dc:date>
    </item>
    <item>
      <title>Re: How do you treat a variable value as another field with Splunk?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-treat-a-variable-value-as-another-field-with-Splunk/m-p/402245#M173728</link>
      <description>&lt;P&gt;thank you very much. This was what I was looking for. Got my query with some minor modifications on this. &lt;/P&gt;</description>
      <pubDate>Fri, 11 Jan 2019 21:49:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-treat-a-variable-value-as-another-field-with-Splunk/m-p/402245#M173728</guid>
      <dc:creator>derekho55</dc:creator>
      <dc:date>2019-01-11T21:49:26Z</dc:date>
    </item>
    <item>
      <title>Re: How do you treat a variable value as another field with Splunk?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-treat-a-variable-value-as-another-field-with-Splunk/m-p/402246#M173729</link>
      <description>&lt;P&gt;It was a fun problem to solve.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jan 2019 22:10:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-treat-a-variable-value-as-another-field-with-Splunk/m-p/402246#M173729</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-01-11T22:10:32Z</dc:date>
    </item>
    <item>
      <title>Re: How do you treat a variable value as another field with Splunk?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-treat-a-variable-value-as-another-field-with-Splunk/m-p/402247#M173730</link>
      <description>&lt;P&gt;It always looks so easy when you see the trick.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jan 2019 23:34:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-treat-a-variable-value-as-another-field-with-Splunk/m-p/402247#M173730</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-01-11T23:34:03Z</dc:date>
    </item>
  </channel>
</rss>

