<?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: Create new fields based on value of another fields. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Create-new-fields-based-on-value-of-another-fields/m-p/495385#M194552</link>
    <description>&lt;P&gt;Hi @paragvidhi,&lt;BR /&gt;
you could try something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=your_index
| rex field=ServerName "\w+\d(?&amp;lt;Node&amp;gt;a|b)"
| eval Node="Node ".Node
| table ServerName Node
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can test the regex at &lt;A href="https://regex101.com/r/jLeU1f/1"&gt;https://regex101.com/r/jLeU1f/1&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
    <pubDate>Fri, 08 May 2020 15:32:31 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2020-05-08T15:32:31Z</dc:date>
    <item>
      <title>Create new fields based on value of another fields.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Create-new-fields-based-on-value-of-another-fields/m-p/495384#M194551</link>
      <description>&lt;P&gt;Hi All,&lt;BR /&gt;
In my log, I have one field called ServerName. Below are some values of that field.&lt;/P&gt;

&lt;P&gt;DAAPP2aBANG2&lt;BR /&gt;
DFAPP20bLON2&lt;BR /&gt;
UATSER1aUS1&lt;BR /&gt;
UATSER1bUS2&lt;/P&gt;

&lt;P&gt;We differentiate the above server with node A and node B based on the first character we got after the first occurrence of one or more digit.&lt;/P&gt;

&lt;P&gt;DAAPP2aBANG2 -- its node a&lt;BR /&gt;
DFAPP20bLON2 --- its node b&lt;BR /&gt;
UATSER1aUS1 --- its node a&lt;BR /&gt;
UATSER1bUS2 --- its node b&lt;/P&gt;

&lt;P&gt;Here I want to create two fields called NodeA, and NodeB&lt;/P&gt;

&lt;P&gt;In NodeA it should contain  DAAPP2aBANG2 ,UATSER1aUS1 &lt;BR /&gt;
In NodeB it should contain  DFAPP20bLON2, UATSER1bUS2&lt;/P&gt;</description>
      <pubDate>Fri, 08 May 2020 15:17:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Create-new-fields-based-on-value-of-another-fields/m-p/495384#M194551</guid>
      <dc:creator>paragvidhi</dc:creator>
      <dc:date>2020-05-08T15:17:47Z</dc:date>
    </item>
    <item>
      <title>Re: Create new fields based on value of another fields.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Create-new-fields-based-on-value-of-another-fields/m-p/495385#M194552</link>
      <description>&lt;P&gt;Hi @paragvidhi,&lt;BR /&gt;
you could try something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=your_index
| rex field=ServerName "\w+\d(?&amp;lt;Node&amp;gt;a|b)"
| eval Node="Node ".Node
| table ServerName Node
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can test the regex at &lt;A href="https://regex101.com/r/jLeU1f/1"&gt;https://regex101.com/r/jLeU1f/1&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 08 May 2020 15:32:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Create-new-fields-based-on-value-of-another-fields/m-p/495385#M194552</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-05-08T15:32:31Z</dc:date>
    </item>
  </channel>
</rss>

