<?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: Field name and value to another Field name with different value in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Field-name-and-value-to-another-Field-name-with-different-value/m-p/643130#M222778</link>
    <description>&lt;P&gt;You have not explained the logic to assign OK or not OK. &amp;nbsp;You haven't even explained whether your real data is just three characters. &amp;nbsp;If it is just that YYN has two "Y"s, this will do&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval char = split(field1, "")
| stats count by field1 char
| where char == "Y"
| eval NewFieldName = if(count == 2, "OK", "NOT OK")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 12 May 2023 05:03:03 GMT</pubDate>
    <dc:creator>yuanliu</dc:creator>
    <dc:date>2023-05-12T05:03:03Z</dc:date>
    <item>
      <title>Field name and value to another Field name with different value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-name-and-value-to-another-Field-name-with-different-value/m-p/643118#M222772</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;We have a extracted field (example field name "Field1) with multiple value&lt;SPAN&gt;&amp;nbsp;such as YYN, YNN, NYN etc.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Based on the current field and field value, would like to have "NewFieldName" and match the result as below smaple. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample&lt;/P&gt;&lt;P&gt;Field1 NewFieldName&lt;/P&gt;&lt;P&gt;YYN "OK"&lt;/P&gt;&lt;P&gt;YNN "NOT OK"&lt;/P&gt;&lt;P&gt;NYN "NOT OK"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2023 03:18:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-name-and-value-to-another-Field-name-with-different-value/m-p/643118#M222772</guid>
      <dc:creator>kyi</dc:creator>
      <dc:date>2023-05-12T03:18:20Z</dc:date>
    </item>
    <item>
      <title>Re: Field name and value to another Field name with different value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-name-and-value-to-another-Field-name-with-different-value/m-p/643130#M222778</link>
      <description>&lt;P&gt;You have not explained the logic to assign OK or not OK. &amp;nbsp;You haven't even explained whether your real data is just three characters. &amp;nbsp;If it is just that YYN has two "Y"s, this will do&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval char = split(field1, "")
| stats count by field1 char
| where char == "Y"
| eval NewFieldName = if(count == 2, "OK", "NOT OK")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2023 05:03:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-name-and-value-to-another-Field-name-with-different-value/m-p/643130#M222778</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-05-12T05:03:03Z</dc:date>
    </item>
    <item>
      <title>Re: Field name and value to another Field name with different value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-name-and-value-to-another-Field-name-with-different-value/m-p/643132#M222779</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/227539"&gt;@kyi&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You sure can.&amp;nbsp; Something like this run anywhere example&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval field1=split("YYN,YNN,NYN,YYY", ",")
| mvexpand field1
 ``` above creates dummy events and is not needed ```
  ``` example below ```
| eval NewFieldName=case(field1="YYN", "OK", field1="YNN", "NOT OK", field1="NYN", "NOT OK", true(), "No match")
| table field1 NewFieldName&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Hope it helps&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2023 05:07:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-name-and-value-to-another-Field-name-with-different-value/m-p/643132#M222779</guid>
      <dc:creator>yeahnah</dc:creator>
      <dc:date>2023-05-12T05:07:17Z</dc:date>
    </item>
    <item>
      <title>Re: Field name and value to another Field name with different value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-name-and-value-to-another-Field-name-with-different-value/m-p/643135#M222782</link>
      <description>&lt;P&gt;Thanks for you information, will do more explanation next time.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2023 05:30:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-name-and-value-to-another-Field-name-with-different-value/m-p/643135#M222782</guid>
      <dc:creator>kyi</dc:creator>
      <dc:date>2023-05-12T05:30:04Z</dc:date>
    </item>
    <item>
      <title>Re: Field name and value to another Field name with different value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-name-and-value-to-another-Field-name-with-different-value/m-p/643137#M222784</link>
      <description>&lt;P&gt;Thank You for your quick response and solution.&lt;/P&gt;&lt;P&gt;Apart from using Eval in the search, any other option we can use for matching?&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example: every time extracted field1 with value we can directly use NewFieldName and it matching value?&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2023 05:34:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-name-and-value-to-another-Field-name-with-different-value/m-p/643137#M222784</guid>
      <dc:creator>kyi</dc:creator>
      <dc:date>2023-05-12T05:34:42Z</dc:date>
    </item>
  </channel>
</rss>

