<?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: Extracting data from host field into a new field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Extracting-data-from-host-field-into-a-new-field/m-p/195099#M56272</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have tried the field extraction from host in 6.2. Here is the sample of mine,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Host: ip-192-168-169-32
Extracted value: 169
Rex: ip-.*-.*-(?&amp;lt;newfield&amp;gt;.*)-.*
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Search : &lt;CODE&gt;index=_internal | head 10 | stats count by host | rex field=host "ip-.*-.*-(?.*)-.*" | table host, newfield&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Guess this will help you,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|stats count | eval host="BUSINESS_PRODUCTION_NYC_ST06" | rex field=host "BUSINESS_PRODUCTION_(?&amp;lt;City&amp;gt;.*)_.*" | table host, City
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 16 Jan 2015 18:20:41 GMT</pubDate>
    <dc:creator>vasanthmss</dc:creator>
    <dc:date>2015-01-16T18:20:41Z</dc:date>
    <item>
      <title>Extracting data from host field into a new field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-data-from-host-field-into-a-new-field/m-p/195095#M56268</link>
      <description>&lt;P&gt;I am trying to extract data from the host field as the name of the host gives information about the location and where in that location something exists.&lt;/P&gt;

&lt;P&gt;Example: host="BUSINESS_PRODUCTION_NYC_ST06"&lt;/P&gt;

&lt;P&gt;In the example above I want to Pull out NYC and put it into a City field. Which I have tried doing that using the following&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=host "BUSINESS_PRODUCTION_(?&amp;lt;City&amp;gt;\w+)_ST\d{2}"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;however when I run that search I do not see the new City field. However if try that using a different field it seems to work.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval host2="BUSINESS_PRODUCTION_NYC_ST02" | rex field=host2 "BUSINESS_PRODUCTION_(?&amp;lt;City&amp;gt;\w+)_ST\d{2}" 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Am I missing something or is this a bug? ( I am using 6.2.0)&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 18:41:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-data-from-host-field-into-a-new-field/m-p/195095#M56268</guid>
      <dc:creator>amontero86</dc:creator>
      <dc:date>2020-09-28T18:41:38Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting data from host field into a new field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-data-from-host-field-into-a-new-field/m-p/195096#M56269</link>
      <description>&lt;P&gt;Was the difference in the above to extraction expressions  &lt;CODE&gt;"\w" vs "\w+"&lt;/CODE&gt; intended? I have seen similar questions and note that it should work the same on indexed fields as well as extracted or _raw data.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jan 2015 18:00:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-data-from-host-field-into-a-new-field/m-p/195096#M56269</guid>
      <dc:creator>chanfoli</dc:creator>
      <dc:date>2015-01-16T18:00:46Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting data from host field into a new field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-data-from-host-field-into-a-new-field/m-p/195097#M56270</link>
      <description>&lt;P&gt;Nope that is what happens when you type rather than copy sorry.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jan 2015 18:02:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-data-from-host-field-into-a-new-field/m-p/195097#M56270</guid>
      <dc:creator>amontero86</dc:creator>
      <dc:date>2015-01-16T18:02:07Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting data from host field into a new field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-data-from-host-field-into-a-new-field/m-p/195098#M56271</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;Hi, Try this,  |stats count  | eval&lt;BR /&gt;
host2="BUSINESS_PRODUCTION_NYC_ST02" |&lt;BR /&gt;
rex field=host2&lt;BR /&gt;
"BUSINESS_PRODUCTION_(?.&lt;EM&gt;)_ST&lt;/EM&gt;"&lt;BR /&gt;
| table host2,City&lt;/P&gt;

&lt;P&gt;Cheerrss!&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;I am not sure why I can't see this response on this page. The query I posted that operates on host2 works without any problems. However when I apply the query to the host field it does not work.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 18:41:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-data-from-host-field-into-a-new-field/m-p/195098#M56271</guid>
      <dc:creator>amontero86</dc:creator>
      <dc:date>2020-09-28T18:41:40Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting data from host field into a new field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-data-from-host-field-into-a-new-field/m-p/195099#M56272</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have tried the field extraction from host in 6.2. Here is the sample of mine,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Host: ip-192-168-169-32
Extracted value: 169
Rex: ip-.*-.*-(?&amp;lt;newfield&amp;gt;.*)-.*
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Search : &lt;CODE&gt;index=_internal | head 10 | stats count by host | rex field=host "ip-.*-.*-(?.*)-.*" | table host, newfield&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Guess this will help you,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|stats count | eval host="BUSINESS_PRODUCTION_NYC_ST06" | rex field=host "BUSINESS_PRODUCTION_(?&amp;lt;City&amp;gt;.*)_.*" | table host, City
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Jan 2015 18:20:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-data-from-host-field-into-a-new-field/m-p/195099#M56272</guid>
      <dc:creator>vasanthmss</dc:creator>
      <dc:date>2015-01-16T18:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting data from host field into a new field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-data-from-host-field-into-a-new-field/m-p/195100#M56273</link>
      <description>&lt;P&gt;I have deleted and re posted the answer.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jan 2015 18:22:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-data-from-host-field-into-a-new-field/m-p/195100#M56273</guid>
      <dc:creator>vasanthmss</dc:creator>
      <dc:date>2015-01-16T18:22:44Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting data from host field into a new field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-data-from-host-field-into-a-new-field/m-p/195101#M56274</link>
      <description>&lt;P&gt;Thanks looking at  your example I realized that I was using underscores instead of dashes. Its always the simple answers smh. Thanks for your time.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jan 2015 18:24:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-data-from-host-field-into-a-new-field/m-p/195101#M56274</guid>
      <dc:creator>amontero86</dc:creator>
      <dc:date>2015-01-16T18:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting data from host field into a new field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-data-from-host-field-into-a-new-field/m-p/195102#M56275</link>
      <description>&lt;P&gt;Enjoy. Cheerrss!&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jan 2015 18:25:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-data-from-host-field-into-a-new-field/m-p/195102#M56275</guid>
      <dc:creator>vasanthmss</dc:creator>
      <dc:date>2015-01-16T18:25:24Z</dc:date>
    </item>
  </channel>
</rss>

