<?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: Rename fields based on Token value in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Rename-fields-based-on-Token-value/m-p/569141#M198362</link>
    <description>&lt;P&gt;sorry, will have to walk me through the :&lt;BR /&gt;[| eval {app}&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; = &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;]&lt;/P&gt;&lt;P&gt;what is that doing and how would that handle multiple values for app?&lt;/P&gt;</description>
    <pubDate>Thu, 30 Sep 2021 13:08:07 GMT</pubDate>
    <dc:creator>mcaulsc</dc:creator>
    <dc:date>2021-09-30T13:08:07Z</dc:date>
    <item>
      <title>Rename fields based on Token value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rename-fields-based-on-Token-value/m-p/569089#M198342</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have some data which spans multiple systems example below:&lt;BR /&gt;&lt;BR /&gt;"system" "app" "fld1" "fld2" "fld3"&lt;/P&gt;&lt;P&gt;sys1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;appA&amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/P&gt;&lt;P&gt;sys1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;appA&amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/P&gt;&lt;P&gt;sys1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; appB&amp;nbsp; &amp;nbsp; 0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;What I'm trying to do is create a generic dashboard so I would need to rename the fields based on the "app" value. So something similar to:&lt;/P&gt;&lt;P&gt;when app=="appA" rename "fld1" as "appAfld1",&amp;nbsp; rename "fld2" as "appAfld2"&lt;/P&gt;&lt;P&gt;when app=="appB" rename "fld1" as "appBfld1"&lt;/P&gt;&lt;P&gt;Then in a table only show the renamed fields, so a conditional table statement again based on the "app" value.&lt;/P&gt;&lt;P&gt;Any ideas on how/if that can be achieved?&amp;nbsp; Alternately I just create separate dashboards but a lot of repetition in that so I suspect there is a way to do it.&lt;/P&gt;&lt;P&gt;Thanks in advance for any ideas.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Sep 2021 09:23:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rename-fields-based-on-Token-value/m-p/569089#M198342</guid>
      <dc:creator>mcaulsc</dc:creator>
      <dc:date>2021-09-30T09:23:15Z</dc:date>
    </item>
    <item>
      <title>Re: Rename fields based on Token value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rename-fields-based-on-Token-value/m-p/569092#M198343</link>
      <description>&lt;LI-CODE lang="markup"&gt;| foreach fld* 
    [| eval {app}&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; = &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;]&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 30 Sep 2021 10:00:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rename-fields-based-on-Token-value/m-p/569092#M198343</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-09-30T10:00:04Z</dc:date>
    </item>
    <item>
      <title>Re: Rename fields based on Token value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rename-fields-based-on-Token-value/m-p/569141#M198362</link>
      <description>&lt;P&gt;sorry, will have to walk me through the :&lt;BR /&gt;[| eval {app}&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; = &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;]&lt;/P&gt;&lt;P&gt;what is that doing and how would that handle multiple values for app?&lt;/P&gt;</description>
      <pubDate>Thu, 30 Sep 2021 13:08:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rename-fields-based-on-Token-value/m-p/569141#M198362</guid>
      <dc:creator>mcaulsc</dc:creator>
      <dc:date>2021-09-30T13:08:07Z</dc:date>
    </item>
    <item>
      <title>Re: Rename fields based on Token value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rename-fields-based-on-Token-value/m-p/569221#M198404</link>
      <description>&lt;P&gt;The braces around the app uses the value of the field as part of the field name and then the name of the field from&amp;nbsp; the foreach &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; is add so {app}&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;&amp;nbsp; = &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; becomes appAfld1 = fld1 which is what you were after.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Sep 2021 20:12:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rename-fields-based-on-Token-value/m-p/569221#M198404</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-09-30T20:12:00Z</dc:date>
    </item>
    <item>
      <title>Re: Rename fields based on Token value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rename-fields-based-on-Token-value/m-p/569278#M198413</link>
      <description>&lt;P&gt;ah, I see now, thanks for the explanation, I got that working and that will be useful.&lt;BR /&gt;&lt;BR /&gt;My example was a bit too literal I think where I masked names. What I'm actually after is a complete rename so:&lt;BR /&gt;&lt;SPAN&gt;when app=="appA" rename "fld1" as "newname1",&amp;nbsp; rename "fld2" as "newname2",&amp;nbsp; rename "fld3" as "newname11"&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Oct 2021 07:53:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rename-fields-based-on-Token-value/m-p/569278#M198413</guid>
      <dc:creator>mcaulsc</dc:creator>
      <dc:date>2021-10-01T07:53:54Z</dc:date>
    </item>
    <item>
      <title>Re: Rename fields based on Token value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rename-fields-based-on-Token-value/m-p/569282#M198415</link>
      <description>&lt;P&gt;so what I really want is something equivalent to&amp;nbsp; IF .... THEN DO&lt;/P&gt;&lt;P&gt;If app =app1 then Do&lt;BR /&gt;&amp;nbsp; &amp;nbsp;rename fld1 as newname1&lt;BR /&gt;&amp;nbsp; &amp;nbsp;rename fld2 as newname2&lt;BR /&gt;&amp;nbsp; &amp;nbsp;rename field3 as newname11&lt;BR /&gt;End&lt;BR /&gt;If app =app2 then Do&lt;BR /&gt;&amp;nbsp; &amp;nbsp;rename fld1 as newnameA&lt;BR /&gt;&amp;nbsp; &amp;nbsp;rename fld2 as newnameB&lt;BR /&gt;&amp;nbsp; &amp;nbsp;rename field3 as newnameYY&lt;BR /&gt;End&lt;/P&gt;&lt;P&gt;Hopefully that makes more sense.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Oct 2021 08:07:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rename-fields-based-on-Token-value/m-p/569282#M198415</guid>
      <dc:creator>mcaulsc</dc:creator>
      <dc:date>2021-10-01T08:07:40Z</dc:date>
    </item>
    <item>
      <title>Re: Rename fields based on Token value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rename-fields-based-on-Token-value/m-p/569284#M198416</link>
      <description>&lt;P&gt;Flip it the other way around&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval newname1=case(app="app1","newname1",app="app2","newnameA")
| eval {newname1}=fld1
| eval newname2=case(app="app1","newname2",app="app2","newnameB")
| eval {newname2}=fld2
etc.&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 01 Oct 2021 08:18:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rename-fields-based-on-Token-value/m-p/569284#M198416</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-10-01T08:18:38Z</dc:date>
    </item>
    <item>
      <title>Re: Rename fields based on Token value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rename-fields-based-on-Token-value/m-p/569293#M198423</link>
      <description>&lt;P&gt;That's it, excellent and I can pull them into a table etc with a generic.&lt;BR /&gt;Thanks for the solution and also the explanations.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Oct 2021 09:14:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rename-fields-based-on-Token-value/m-p/569293#M198423</guid>
      <dc:creator>mcaulsc</dc:creator>
      <dc:date>2021-10-01T09:14:45Z</dc:date>
    </item>
  </channel>
</rss>

