<?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 I create a field whose name is the value of another field? Like backticks or eval() in other languages. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-field-whose-name-is-the-value-of-another-field/m-p/73955#M181157</link>
    <description>&lt;P&gt;Found the documentation here:&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Eval#General"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Eval#General&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 03 Mar 2017 17:18:49 GMT</pubDate>
    <dc:creator>mstadler_splunk</dc:creator>
    <dc:date>2017-03-03T17:18:49Z</dc:date>
    <item>
      <title>How do I create a field whose name is the value of another field? Like backticks or eval() in other languages.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-field-whose-name-is-the-value-of-another-field/m-p/73947#M181149</link>
      <description>&lt;P&gt;I have a set of data, perhaps XML, perhaps 5.x+ PerfMon, and it's in this format:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;aName=Field1 aValue=123
aName=Field1 aValue=234
aName=Field2 aValue=345
aName=Field2 aValue=456
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I would love to do a &lt;CODE&gt;| stats avg(Field1) avg(Field2)&lt;/CODE&gt; but I can't get at the values!&lt;/P&gt;

&lt;P&gt;How can I create a field with the name of aName, and the value of aValue? This is very similar to backticks or the eval() function in other languages.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2013 08:37:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-field-whose-name-is-the-value-of-another-field/m-p/73947#M181149</guid>
      <dc:creator>Jason</dc:creator>
      <dc:date>2013-09-26T08:37:22Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create a field whose name is the value of another field? Like backticks or eval() in other languages.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-field-whose-name-is-the-value-of-another-field/m-p/73948#M181150</link>
      <description>&lt;P&gt;This does not seem to be documented anywhere, but you can use the curly braces to create fields that are based on field values. In the example above, run the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval {aName}=aValue
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And you will end up with:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;aName=Field1 aValue=123 Field1=123
aName=Field1 aValue=234 Field1=234
aName=Field2 aValue=345 Field2=345
aName=Field2 aValue=456 Field2=456
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And now you can run stats on &lt;CODE&gt;Field1&lt;/CODE&gt; and &lt;CODE&gt;Field2&lt;/CODE&gt;!&lt;/P&gt;

&lt;P&gt;You can also append other text to the field names: &lt;CODE&gt;| eval my{aName}=aValue&lt;/CODE&gt; would create &lt;CODE&gt;myField1&lt;/CODE&gt; and &lt;CODE&gt;myField2&lt;/CODE&gt; fields.&lt;/P&gt;

&lt;P&gt;Naturally, beware using this on fields that have large numbers of values!&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2013 08:40:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-field-whose-name-is-the-value-of-another-field/m-p/73948#M181150</guid>
      <dc:creator>Jason</dc:creator>
      <dc:date>2013-09-26T08:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create a field whose name is the value of another field? Like backticks or eval() in other languages.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-field-whose-name-is-the-value-of-another-field/m-p/73949#M181151</link>
      <description>&lt;P&gt;Wow that's huge, thanks Jason!&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2013 15:01:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-field-whose-name-is-the-value-of-another-field/m-p/73949#M181151</guid>
      <dc:creator>mikelanghorst</dc:creator>
      <dc:date>2013-09-26T15:01:19Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create a field whose name is the value of another field? Like backticks or eval() in other languages.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-field-whose-name-is-the-value-of-another-field/m-p/73950#M181152</link>
      <description>&lt;P&gt;You're welcome. It looks like this only works on the left hand side of the equals sign though.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2014 21:19:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-field-whose-name-is-the-value-of-another-field/m-p/73950#M181152</guid>
      <dc:creator>Jason</dc:creator>
      <dc:date>2014-01-27T21:19:20Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create a field whose name is the value of another field? Like backticks or eval() in other languages.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-field-whose-name-is-the-value-of-another-field/m-p/73951#M181153</link>
      <description>&lt;P&gt;Does it work for saved searches? &lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2016 13:29:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-field-whose-name-is-the-value-of-another-field/m-p/73951#M181153</guid>
      <dc:creator>chrishi</dc:creator>
      <dc:date>2016-08-19T13:29:17Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create a field whose name is the value of another field? Like backticks or eval() in other languages.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-field-whose-name-is-the-value-of-another-field/m-p/73952#M181154</link>
      <description>&lt;P&gt;I found out how to fix my issue: the field value cannot be "-" as in my case.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2016 13:42:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-field-whose-name-is-the-value-of-another-field/m-p/73952#M181154</guid>
      <dc:creator>chrishi</dc:creator>
      <dc:date>2016-08-19T13:42:47Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create a field whose name is the value of another field? Like backticks or eval() in other languages.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-field-whose-name-is-the-value-of-another-field/m-p/73953#M181155</link>
      <description>&lt;P&gt;Yep, because on the right you don't need them &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Great find, thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 16 Feb 2017 23:18:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-field-whose-name-is-the-value-of-another-field/m-p/73953#M181155</guid>
      <dc:creator>rharrisssi</dc:creator>
      <dc:date>2017-02-16T23:18:36Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create a field whose name is the value of another field? Like backticks or eval() in other languages.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-field-whose-name-is-the-value-of-another-field/m-p/73954#M181156</link>
      <description>&lt;P&gt;Right because you aren't allowed to create a variable with that character alone.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Feb 2017 23:21:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-field-whose-name-is-the-value-of-another-field/m-p/73954#M181156</guid>
      <dc:creator>rharrisssi</dc:creator>
      <dc:date>2017-02-16T23:21:38Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create a field whose name is the value of another field? Like backticks or eval() in other languages.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-field-whose-name-is-the-value-of-another-field/m-p/73955#M181157</link>
      <description>&lt;P&gt;Found the documentation here:&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Eval#General"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Eval#General&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2017 17:18:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-field-whose-name-is-the-value-of-another-field/m-p/73955#M181157</guid>
      <dc:creator>mstadler_splunk</dc:creator>
      <dc:date>2017-03-03T17:18:49Z</dc:date>
    </item>
  </channel>
</rss>

