<?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: how to extract this ip address in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/how-to-extract-this-ip-address/m-p/281964#M190568</link>
    <description>&lt;P&gt;"api" AND "delete" AND ("neutron" OR "nova" OR "cinder" OR "glance") | rex field=_raw "api:(?\s\d+.\d+.\d+.\d+){0,3}" |mvexpand ipip | table ipip | stats count by ipip&lt;/P&gt;

&lt;P&gt;this show more ip then previous answer&lt;/P&gt;</description>
    <pubDate>Thu, 28 Jul 2016 01:15:18 GMT</pubDate>
    <dc:creator>cyberportnoc</dc:creator>
    <dc:date>2016-07-28T01:15:18Z</dc:date>
    <item>
      <title>how to extract this ip address</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-extract-this-ip-address/m-p/281959#M190563</link>
      <description>&lt;P&gt;"api" AND "delete" AND ("neutron" OR "nova" OR "cinder" OR "glance") | rex field=_raw "api:(?\s\d+.\d+.\d+.\d+)" | stats ipip&lt;/P&gt;

&lt;P&gt;no result after added "| stats ipip"&lt;/P&gt;

&lt;P&gt;Jul 27 16:47:59 iccontroller01 neutron-api: 192.168.120.5, 192.168.100.104 - - [27/Jul/2016:16:47:59 +0800] "DELETE /v2.0/floatingips/34840e14-8387-4cf0-bd26-b3f84782a8c9.json HTTP/1.1" 204 - "-" "python-neutronclient"&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2016 09:06:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-extract-this-ip-address/m-p/281959#M190563</guid>
      <dc:creator>cyberportnoc</dc:creator>
      <dc:date>2016-07-27T09:06:19Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract this ip address</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-extract-this-ip-address/m-p/281960#M190564</link>
      <description>&lt;P&gt;"ipip" is not a valid argument to the &lt;CODE&gt;stats&lt;/CODE&gt; command.  It's not a field, either.  It's not clear what you're trying to do with the search, but something like this should get some results.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"api" AND "delete" AND ("neutron" OR "nova" OR "cinder" OR "glance") | rex field=_raw "api:\s(?&amp;lt;ipip&amp;gt;\d+.\d+.\d+.\d+)" | stats list(ipip)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Jul 2016 12:20:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-extract-this-ip-address/m-p/281960#M190564</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2016-07-27T12:20:18Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract this ip address</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-extract-this-ip-address/m-p/281961#M190565</link>
      <description>&lt;P&gt;As your splunk search isn't formatted correctly, I hope I got it right (use the "Code Sample" button above when posting a Splunk Search).&lt;/P&gt;

&lt;P&gt;Using your regex I can extract it without a problem:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search | rex field=_raw "api:(?&amp;lt;ipip&amp;gt;\s\d+.\d+.\d+.\d+)" | stats first(ipip)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Jul 2016 12:28:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-extract-this-ip-address/m-p/281961#M190565</guid>
      <dc:creator>Raschko</dc:creator>
      <dc:date>2016-07-27T12:28:05Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract this ip address</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-extract-this-ip-address/m-p/281962#M190566</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"api" AND "delete" AND ("neutron" OR "nova" OR "cinder" OR "glance") | rex field=_raw "api:( \d+\.\d+\.\d+\.\d+,?){0,3}" |mvexpand IP | table IP
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Jul 2016 12:35:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-extract-this-ip-address/m-p/281962#M190566</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-07-27T12:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract this ip address</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-extract-this-ip-address/m-p/281963#M190567</link>
      <description>&lt;P&gt;command first(ipip) can extract but only show one ip result , and when i count it, no result found&lt;/P&gt;

&lt;P&gt;"api" AND "delete" AND ("neutron" OR "nova" OR "cinder" OR "glance") | rex field=_raw "api:(?\s\d+.\d+.\d+.\d+)" | stats count by first(ipip)&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2016 01:10:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-extract-this-ip-address/m-p/281963#M190567</guid>
      <dc:creator>cyberportnoc</dc:creator>
      <dc:date>2016-07-28T01:10:32Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract this ip address</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-extract-this-ip-address/m-p/281964#M190568</link>
      <description>&lt;P&gt;"api" AND "delete" AND ("neutron" OR "nova" OR "cinder" OR "glance") | rex field=_raw "api:(?\s\d+.\d+.\d+.\d+){0,3}" |mvexpand ipip | table ipip | stats count by ipip&lt;/P&gt;

&lt;P&gt;this show more ip then previous answer&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2016 01:15:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-extract-this-ip-address/m-p/281964#M190568</guid>
      <dc:creator>cyberportnoc</dc:creator>
      <dc:date>2016-07-28T01:15:18Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract this ip address</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-extract-this-ip-address/m-p/281965#M190569</link>
      <description>&lt;P&gt;what do {0,3} mean ?&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2016 01:22:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-extract-this-ip-address/m-p/281965#M190569</guid>
      <dc:creator>cyberportnoc</dc:creator>
      <dc:date>2016-07-28T01:22:55Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract this ip address</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-extract-this-ip-address/m-p/281966#M190570</link>
      <description>&lt;P&gt;{0,3} means the group can occur 0 - 3 times. In this case, the group is space followed by IP pattern. If the IP can only appear in that segment of the event, you could also do &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.... | raw max_match=0 (?&amp;lt;ip&amp;gt;\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The only risk with this is it will capture all IP addresses no matter where they appear in the event.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2016 02:16:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-extract-this-ip-address/m-p/281966#M190570</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-07-28T02:16:47Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract this ip address</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-extract-this-ip-address/m-p/281967#M190571</link>
      <description>&lt;P&gt;The stats function "first" just shows the first ipip that was seen by splunk.&lt;/P&gt;

&lt;P&gt;To count by extracted IP addresses use something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"api" AND "delete" AND ("neutron" OR "nova" OR "cinder" OR "glance") | rex field=_raw "api:\s(?&amp;lt;ipip&amp;gt;\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})" | stats count by ipip
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It still only extracts the first IP address following "api: " of the log event.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2016 02:55:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-extract-this-ip-address/m-p/281967#M190571</guid>
      <dc:creator>Raschko</dc:creator>
      <dc:date>2016-07-28T02:55:09Z</dc:date>
    </item>
  </channel>
</rss>

