<?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 Using inline REX to extract duplicate hosts, how do I identify the unique number of hosts reporting from a source? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Using-inline-REX-to-extract-duplicate-hosts-how-do-I-identify/m-p/275291#M83034</link>
    <description>&lt;P&gt;I am trying to identify the unique number of hosts reporting from a source. When the source is indexed, the host field sometimes is FQDN and sometimes is IP address. They are not duplicate entries, just different data/logs.&lt;/P&gt;

&lt;P&gt;I have two separate searches, one that ignores the IP address hosts and delivers unique hosts as FQDN:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="logsource"
| search host!="10.xxx"
| dedup host
| stats count by host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And one that uses the rex (I'm new to using this) option to pull the FQDN elsewhere in the log:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="logsource"
| search host="10.xxx"
| rex field=_raw "leadingText,  (newhostfield.) trailingText"
| dedup newhostfield
| stats count by newhostfield, host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to combine the two lists in a search and dedup to give me a unique list of hosts from this log source.&lt;/P&gt;

&lt;P&gt;Anyone able to point me in the right direction?&lt;BR /&gt;
Thanks&lt;/P&gt;</description>
    <pubDate>Thu, 08 Dec 2016 21:01:05 GMT</pubDate>
    <dc:creator>stacejr</dc:creator>
    <dc:date>2016-12-08T21:01:05Z</dc:date>
    <item>
      <title>Using inline REX to extract duplicate hosts, how do I identify the unique number of hosts reporting from a source?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-inline-REX-to-extract-duplicate-hosts-how-do-I-identify/m-p/275291#M83034</link>
      <description>&lt;P&gt;I am trying to identify the unique number of hosts reporting from a source. When the source is indexed, the host field sometimes is FQDN and sometimes is IP address. They are not duplicate entries, just different data/logs.&lt;/P&gt;

&lt;P&gt;I have two separate searches, one that ignores the IP address hosts and delivers unique hosts as FQDN:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="logsource"
| search host!="10.xxx"
| dedup host
| stats count by host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And one that uses the rex (I'm new to using this) option to pull the FQDN elsewhere in the log:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="logsource"
| search host="10.xxx"
| rex field=_raw "leadingText,  (newhostfield.) trailingText"
| dedup newhostfield
| stats count by newhostfield, host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to combine the two lists in a search and dedup to give me a unique list of hosts from this log source.&lt;/P&gt;

&lt;P&gt;Anyone able to point me in the right direction?&lt;BR /&gt;
Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2016 21:01:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-inline-REX-to-extract-duplicate-hosts-how-do-I-identify/m-p/275291#M83034</guid>
      <dc:creator>stacejr</dc:creator>
      <dc:date>2016-12-08T21:01:05Z</dc:date>
    </item>
    <item>
      <title>Re: Using inline REX to extract duplicate hosts, how do I identify the unique number of hosts reporting from a source?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-inline-REX-to-extract-duplicate-hosts-how-do-I-identify/m-p/275292#M83035</link>
      <description>&lt;P&gt;Give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="logsource"
| rex field=_raw "leadingText,  (newhostfield.) trailingText"
| eval newhostfield=if(match(host,"^10\..+"),newhostfield,host)
| stats dc(newhostfield) as count by newhostfield, host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Dec 2016 22:22:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-inline-REX-to-extract-duplicate-hosts-how-do-I-identify/m-p/275292#M83035</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-12-08T22:22:04Z</dc:date>
    </item>
  </channel>
</rss>

