<?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 How to rename fields conditionally? in Splunk Enterprise</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-rename-fields-conditionally/m-p/636780#M15897</link>
    <description>&lt;P&gt;Im trying to create multiple fields names from the same based on condition that other values are met.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to do this multiple times in 1 search to create new field names&lt;/P&gt;
&lt;P&gt;For example;&lt;/P&gt;
&lt;P&gt;if event=av AND cmd=judgement then RENAME the field "result" to AV_Result&lt;BR /&gt;if event=spam AND cmd=judgement then RENAME the field "result" to Spam_Result&lt;BR /&gt;if action=quarantine AND mod=session AND cmd=kill then RENAME the field "Folder" to "Final_Folder_Result"&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Id like to do all this in 1 search&lt;/P&gt;</description>
    <pubDate>Fri, 31 Mar 2023 16:23:21 GMT</pubDate>
    <dc:creator>daniel_althoff8</dc:creator>
    <dc:date>2023-03-31T16:23:21Z</dc:date>
    <item>
      <title>How to rename fields conditionally?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-rename-fields-conditionally/m-p/636780#M15897</link>
      <description>&lt;P&gt;Im trying to create multiple fields names from the same based on condition that other values are met.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to do this multiple times in 1 search to create new field names&lt;/P&gt;
&lt;P&gt;For example;&lt;/P&gt;
&lt;P&gt;if event=av AND cmd=judgement then RENAME the field "result" to AV_Result&lt;BR /&gt;if event=spam AND cmd=judgement then RENAME the field "result" to Spam_Result&lt;BR /&gt;if action=quarantine AND mod=session AND cmd=kill then RENAME the field "Folder" to "Final_Folder_Result"&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Id like to do all this in 1 search&lt;/P&gt;</description>
      <pubDate>Fri, 31 Mar 2023 16:23:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-rename-fields-conditionally/m-p/636780#M15897</guid>
      <dc:creator>daniel_althoff8</dc:creator>
      <dc:date>2023-03-31T16:23:21Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Fields Conditionally</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-rename-fields-conditionally/m-p/636794#M15900</link>
      <description>&lt;P&gt;You can't do conditional rename, but you can do condition assignment, but here your origin and target fields are different along with the conditions, so what are you trying to achieve here?&lt;/P&gt;&lt;P&gt;You can do this for the first two&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval {event}_Result=if(in(event, "av","spam") AND cmd="judgement", result, null())&lt;/LI-CODE&gt;&lt;P&gt;which will create fields av_Result and spam_Result based on result, but it's not AV_Result or Spam_Result.&lt;/P&gt;&lt;P&gt;and this approach will not work for your Folder as everything is different, so what's the point?&lt;/P&gt;&lt;P&gt;An eval statement only has a single left hand side assignment and you are trying to assign 2 different fields to 3 different names...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Mar 2023 02:13:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-rename-fields-conditionally/m-p/636794#M15900</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-03-31T02:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Fields Conditionally</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-rename-fields-conditionally/m-p/636814#M15902</link>
      <description>&lt;LI-CODE lang="markup"&gt;| eval AV_Result=if(event=="av" AND cmd=="judgement", result, null())
| eval Spam_Result=if(event=="spam" AND cmd=="judgement", result, null())
| eval Final_Folder_Result=if(action=="quarantine" AND mod=="session" AND cmd=="kill", Folder, null())&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 31 Mar 2023 05:35:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-rename-fields-conditionally/m-p/636814#M15902</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-03-31T05:35:26Z</dc:date>
    </item>
  </channel>
</rss>

