<?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 extract host name from field in Knowledge Management</title>
    <link>https://community.splunk.com/t5/Knowledge-Management/extract-host-name-from-field/m-p/380940#M6374</link>
    <description>&lt;P&gt;Hi everybody&lt;/P&gt;

&lt;P&gt;I wanted to extract all hostname from this field "local_address" and save in a new field call "host" so that i only get the hostnames after "@" &lt;BR /&gt;
I believe we can do it by "search | spath  | rex field=local_address "@(?P[^-]+)"| stats count by _time host"&lt;BR /&gt;
please corerct this.&lt;BR /&gt;
below is the exact field&lt;/P&gt;

&lt;P&gt;local_address&lt;BR /&gt;
&lt;A href="mailto:14081300@abc3-def-ghi1101.jklm.opqr.com" target="_blank"&gt;14081300@abc3-def-ghi1101.jklm.opqr.com&lt;/A&gt; &lt;BR /&gt;
&lt;A href="mailto:13546330@wer2-gre-oug1201.jklm.opqr.com" target="_blank"&gt;13546330@wer2-gre-oug1201.jklm.opqr.com&lt;/A&gt;&lt;BR /&gt;
thanks&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 23:52:37 GMT</pubDate>
    <dc:creator>splunkuseradmin</dc:creator>
    <dc:date>2020-09-29T23:52:37Z</dc:date>
    <item>
      <title>extract host name from field</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/extract-host-name-from-field/m-p/380940#M6374</link>
      <description>&lt;P&gt;Hi everybody&lt;/P&gt;

&lt;P&gt;I wanted to extract all hostname from this field "local_address" and save in a new field call "host" so that i only get the hostnames after "@" &lt;BR /&gt;
I believe we can do it by "search | spath  | rex field=local_address "@(?P[^-]+)"| stats count by _time host"&lt;BR /&gt;
please corerct this.&lt;BR /&gt;
below is the exact field&lt;/P&gt;

&lt;P&gt;local_address&lt;BR /&gt;
&lt;A href="mailto:14081300@abc3-def-ghi1101.jklm.opqr.com" target="_blank"&gt;14081300@abc3-def-ghi1101.jklm.opqr.com&lt;/A&gt; &lt;BR /&gt;
&lt;A href="mailto:13546330@wer2-gre-oug1201.jklm.opqr.com" target="_blank"&gt;13546330@wer2-gre-oug1201.jklm.opqr.com&lt;/A&gt;&lt;BR /&gt;
thanks&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:52:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/extract-host-name-from-field/m-p/380940#M6374</guid>
      <dc:creator>splunkuseradmin</dc:creator>
      <dc:date>2020-09-29T23:52:37Z</dc:date>
    </item>
    <item>
      <title>Re: extract host name from field</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/extract-host-name-from-field/m-p/380941#M6375</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;You can try below search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;yourBaseSearch&amp;gt;
| spath
| rex field=local_address "\@(?&amp;lt;ext_host&amp;gt;[^\h]*)"
| stats count by ext_host,_time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Mar 2019 20:08:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/extract-host-name-from-field/m-p/380941#M6375</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2019-03-26T20:08:46Z</dc:date>
    </item>
    <item>
      <title>Re: extract host name from field</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/extract-host-name-from-field/m-p/380942#M6376</link>
      <description>&lt;P&gt;If &lt;CODE&gt;local_address&lt;/CODE&gt; is multi-valued field then you can try below query&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;yourBaseSearch&amp;gt;
| spath
| rex field=local_address "\@(?&amp;lt;ext_host&amp;gt;[^\v]*)" max_match=0
| mvexpand ext_host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Mar 2019 20:12:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/extract-host-name-from-field/m-p/380942#M6376</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2019-03-26T20:12:27Z</dc:date>
    </item>
  </channel>
</rss>

