<?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: rex to create two new fields from a single field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-two-new-fields-from-a-single-field/m-p/635932#M220920</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/242392"&gt;@bt149&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;you could try something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;your_search&amp;gt;
| rex field=src "(?&amp;lt;ip&amp;gt;\d+\.\d+\.\d+\.\d+)"
| eval src_nt_host=if(isempty(ip),src,"")
| ...&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
    <pubDate>Fri, 24 Mar 2023 13:41:15 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2023-03-24T13:41:15Z</dc:date>
    <item>
      <title>How to create two new fields from a single field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-two-new-fields-from-a-single-field/m-p/635929#M220918</link>
      <description>&lt;P&gt;I have a log set from FW's. These logs have a field called "src."&amp;nbsp; From what I can tell, this field is populated with values such as:&lt;BR /&gt;FQDN (myhost.mydomain.com)&lt;BR /&gt;Console or telnet&lt;BR /&gt;10.0.0.1&lt;BR /&gt;&lt;BR /&gt;I'm looking to have two fields created from the "src" field, one name IP if the value in "src" is an IP and "src_nt_host" if the value is not an ip_address.&amp;nbsp; A small sample from the logged event:&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN class=""&gt;From:&lt;/SPAN&gt; &lt;SPAN class=""&gt;Console&lt;/SPAN&gt; &lt;SPAN class=""&gt;or&lt;/SPAN&gt; &lt;SPAN class=""&gt;&lt;SPAN class=""&gt;telnet&lt;/SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class=""&gt;From:&lt;/SPAN&gt;&amp;nbsp;myhost&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;.mydomain&lt;/SPAN&gt;.com.&lt;BR /&gt;&lt;/SPAN&gt;From: 10.0.0.1.&lt;/P&gt;
&lt;P&gt;Any help / guidance is greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Mar 2023 14:13:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-two-new-fields-from-a-single-field/m-p/635929#M220918</guid>
      <dc:creator>bt149</dc:creator>
      <dc:date>2023-03-24T14:13:49Z</dc:date>
    </item>
    <item>
      <title>Re: rex to create two new fields from a single field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-two-new-fields-from-a-single-field/m-p/635932#M220920</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/242392"&gt;@bt149&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;you could try something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;your_search&amp;gt;
| rex field=src "(?&amp;lt;ip&amp;gt;\d+\.\d+\.\d+\.\d+)"
| eval src_nt_host=if(isempty(ip),src,"")
| ...&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 24 Mar 2023 13:41:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-two-new-fields-from-a-single-field/m-p/635932#M220920</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-03-24T13:41:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to create two new fields from a single field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-two-new-fields-from-a-single-field/m-p/635934#M220921</link>
      <description>&lt;P&gt;Thank you but that didn't do the trick.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Mar 2023 14:25:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-two-new-fields-from-a-single-field/m-p/635934#M220921</guid>
      <dc:creator>bt149</dc:creator>
      <dc:date>2023-03-24T14:25:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to create two new fields from a single field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-two-new-fields-from-a-single-field/m-p/636007#M220937</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/242392"&gt;@bt149&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Sorry, please try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;your_search&amp;gt;
| rex field=src "(?&amp;lt;ip&amp;gt;\d+\.\d+\.\d+\.\d+)"
| eval src_nt_host=if(isnull(ip),src,"")&lt;/LI-CODE&gt;&lt;P&gt;that I tested&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="gcusello_0-1679725939051.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/24530iF0E64547BD9422A6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="gcusello_0-1679725939051.png" alt="gcusello_0-1679725939051.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Sat, 25 Mar 2023 06:32:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-two-new-fields-from-a-single-field/m-p/636007#M220937</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-03-25T06:32:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to create two new fields from a single field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-two-new-fields-from-a-single-field/m-p/636024#M220940</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;SPAN&gt;Giuseppe!&amp;nbsp; This worked well.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Mar 2023 12:02:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-two-new-fields-from-a-single-field/m-p/636024#M220940</guid>
      <dc:creator>bt149</dc:creator>
      <dc:date>2023-03-25T12:02:14Z</dc:date>
    </item>
  </channel>
</rss>

