<?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: Regex, and extracting the IP + hostname from _internal in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-and-extracting-the-IP-hostname-from-internal/m-p/438624#M124844</link>
    <description>&lt;P&gt;Try &lt;CODE&gt;component=tcpinconnection&lt;/CODE&gt;.&lt;/P&gt;</description>
    <pubDate>Thu, 14 Mar 2019 12:23:40 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2019-03-14T12:23:40Z</dc:date>
    <item>
      <title>Regex, and extracting the IP + hostname from _internal</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-and-extracting-the-IP-hostname-from-internal/m-p/438620#M124840</link>
      <description>&lt;P&gt;One of my ongoing gripes with splunk is that there is no way to see the IP and the hostname -- either my forwarder sends a hostname, or an IP. Not both. I know the information is there, as I can see it in the _internal splunkd log.&lt;BR /&gt;
So, I was trying to make a list of all IP+hostnames out of this list:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal uri=* component=HttpPubSubConnection
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Result: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;HttpPubSubConnection - Running phone uri=/services/broker/phonehome/connection_ipaddress_8089_instancename_hostname_FAB4D96E-5A4A-4593-8914-635506217E40
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In the URI, it has the ip and a hostname. So, I want to extract this!&lt;BR /&gt;
In the splunk field extractor, I type my own regex,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; ^(?:[^_]+_){4}(?P&amp;lt;internal_ip&amp;gt;[^_ ]+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This works great! It shows all my matches, I save it, run my search, all is well.&lt;/P&gt;

&lt;P&gt;Now if I do the same without the props.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal uri=* component=HttpPubSubConnection | regex  "^(?:[^_]+_){1}(?P&amp;lt;internal_ip&amp;gt;[^_ ]+)" | table internal_ip
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Nothing.&lt;BR /&gt;
I could do it all via props.conf, but there are so many situations where that regex matches outside the specific search I want to run that I figured it was much more efficient to just do the regex in the search string. But, no extraction seems to be happening.&lt;BR /&gt;
Any suggestions?&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2019 20:43:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-and-extracting-the-IP-hostname-from-internal/m-p/438620#M124840</guid>
      <dc:creator>oliverj</dc:creator>
      <dc:date>2019-03-12T20:43:11Z</dc:date>
    </item>
    <item>
      <title>Re: Regex, and extracting the IP + hostname from _internal</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-and-extracting-the-IP-hostname-from-internal/m-p/438621#M124841</link>
      <description>&lt;P&gt;The &lt;CODE&gt;regex&lt;/CODE&gt; command does not do field extractions.  Use &lt;CODE&gt;rex&lt;/CODE&gt;, instead.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex field=uri "[^_]+_(?P&amp;lt;internal_ip&amp;gt;[^_ ]+)_\d+_[^_]+_(?&amp;lt;hostname&amp;gt;[^_]+)" | ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Mar 2019 21:02:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-and-extracting-the-IP-hostname-from-internal/m-p/438621#M124841</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-03-12T21:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: Regex, and extracting the IP + hostname from _internal</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-and-extracting-the-IP-hostname-from-internal/m-p/438622#M124842</link>
      <description>&lt;P&gt;That was exactly what I needed. Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2019 13:26:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-and-extracting-the-IP-hostname-from-internal/m-p/438622#M124842</guid>
      <dc:creator>oliverj</dc:creator>
      <dc:date>2019-03-13T13:26:55Z</dc:date>
    </item>
    <item>
      <title>Re: Regex, and extracting the IP + hostname from _internal</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-and-extracting-the-IP-hostname-from-internal/m-p/438623#M124843</link>
      <description>&lt;P&gt;To anyone who finds this post later -- this is a terrible search. I just realized it only pulls data from hosts that use deployment servers, not all UniversalForwarders. So anything that sends without being a part of the deployment server (for us, hundreds of devices we don't own) will not show up. Sigh.&lt;/P&gt;

&lt;P&gt;But the search/extraction still works great! Just...back to the drawing board.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2019 13:56:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-and-extracting-the-IP-hostname-from-internal/m-p/438623#M124843</guid>
      <dc:creator>oliverj</dc:creator>
      <dc:date>2019-03-13T13:56:25Z</dc:date>
    </item>
    <item>
      <title>Re: Regex, and extracting the IP + hostname from _internal</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-and-extracting-the-IP-hostname-from-internal/m-p/438624#M124844</link>
      <description>&lt;P&gt;Try &lt;CODE&gt;component=tcpinconnection&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2019 12:23:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-and-extracting-the-IP-hostname-from-internal/m-p/438624#M124844</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-03-14T12:23:40Z</dc:date>
    </item>
  </channel>
</rss>

