<?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: Extract second instance of IP address in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Extract-second-instance-of-IP-address/m-p/525405#M148266</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/226924"&gt;@Pmeiring&lt;/a&gt;&amp;nbsp;..this rex works fine.. (thanks to&amp;nbsp;@Ayn for the rex)&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval log="2020-10-19 14:13:54 12.23.34.45 POST testing@domain.com 34.56.78.89" 
| rex field=log "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}.+?(?&amp;lt;ip_addr&amp;gt;\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})" 
| table ip_addr&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="rex-ip.jpg" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/11360iF4BDC2DF88895341/image-size/large?v=v2&amp;amp;px=999" role="button" title="rex-ip.jpg" alt="rex-ip.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 19 Oct 2020 15:53:55 GMT</pubDate>
    <dc:creator>inventsekar</dc:creator>
    <dc:date>2020-10-19T15:53:55Z</dc:date>
    <item>
      <title>Extract second instance of IP address</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-second-instance-of-IP-address/m-p/525389#M148254</link>
      <description>&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm currently in trying to extract the second IP address in each log as an field, but I'm simply not able to achive the desired results. The log differ quite variably and I'm unable to get a reliable pattern to "use" only the second match on IP address&amp;nbsp;&lt;/P&gt;&lt;P&gt;REGEX query to grab match IP address&lt;/P&gt;&lt;P&gt;(?P&amp;lt;Public_IP_Test&amp;gt;\d+\.\d+\.\d+\.\d+)&lt;/P&gt;&lt;P&gt;Log Example&amp;nbsp;&lt;/P&gt;&lt;P&gt;2020-10-19 14:13:54 12.23.34.45 POST /owa/service.svc action=FindItem&amp;amp;UA=0&amp;amp;ID=-18&amp;amp;AD=1&amp;amp;CorrelationID=e275e3c1-7ccb-4ac9-95a3-58550573648f_160312683455318;&amp;amp;ClientId=***************; 443 testing@domain.com 34.56.78.89 Mozilla/5.0+(iPhone;+CPU+iPhone+OS+13_3_1+like+Mac+OS+X)+AppleWebKit/605.1.15+(KHTML,+like+Gecko)+Version/13.0.5+Mobile/15E148+Safari/604.1 &lt;A href="https://mail.domain.com/owa/" target="_blank" rel="noopener"&gt;https://mail.domain.com/owa/&lt;/A&gt; 200 0 0 124&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any assistance will be greatly appreciated&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Oct 2020 14:57:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-second-instance-of-IP-address/m-p/525389#M148254</guid>
      <dc:creator>Pmeiring</dc:creator>
      <dc:date>2020-10-19T14:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: Extract second instance of IP address</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-second-instance-of-IP-address/m-p/525391#M148256</link>
      <description>&lt;P&gt;Try this:&amp;nbsp; &lt;STRONG&gt;^(?:[^ \n]* ){8}(?P&amp;lt;Public_IP_Test&amp;gt;[^ ]+)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Is this what you need?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Oct 2020 15:11:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-second-instance-of-IP-address/m-p/525391#M148256</guid>
      <dc:creator>Azeemering</dc:creator>
      <dc:date>2020-10-19T15:11:24Z</dc:date>
    </item>
    <item>
      <title>Re: Extract second instance of IP address</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-second-instance-of-IP-address/m-p/525405#M148266</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/226924"&gt;@Pmeiring&lt;/a&gt;&amp;nbsp;..this rex works fine.. (thanks to&amp;nbsp;@Ayn for the rex)&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval log="2020-10-19 14:13:54 12.23.34.45 POST testing@domain.com 34.56.78.89" 
| rex field=log "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}.+?(?&amp;lt;ip_addr&amp;gt;\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})" 
| table ip_addr&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="rex-ip.jpg" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/11360iF4BDC2DF88895341/image-size/large?v=v2&amp;amp;px=999" role="button" title="rex-ip.jpg" alt="rex-ip.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Oct 2020 15:53:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-second-instance-of-IP-address/m-p/525405#M148266</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2020-10-19T15:53:55Z</dc:date>
    </item>
    <item>
      <title>Re: Extract second instance of IP address</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-second-instance-of-IP-address/m-p/525415#M148272</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/169081"&gt;@Azeemering&lt;/a&gt;&amp;nbsp;for my learning, i tried this rex, but, somehow its giving error only.. starting with "^".. should i escape it or please format the rex query. thanks..&lt;/P&gt;</description>
      <pubDate>Mon, 19 Oct 2020 16:16:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-second-instance-of-IP-address/m-p/525415#M148272</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2020-10-19T16:16:42Z</dc:date>
    </item>
    <item>
      <title>Re: Extract second instance of IP address</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-second-instance-of-IP-address/m-p/525420#M148276</link>
      <description>&lt;P&gt;Try this in your search bar:&lt;/P&gt;&lt;P&gt;index=yourindex sourcetype=yoursourcetype | rex "^(?:[^ \n]* ){8}(?P&amp;lt;Public_IP_Test&amp;gt;[^ ]+)"&lt;/P&gt;&lt;P&gt;This works fine for me and extracts the second ip as the specified field&lt;/P&gt;</description>
      <pubDate>Mon, 19 Oct 2020 16:24:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-second-instance-of-IP-address/m-p/525420#M148276</guid>
      <dc:creator>Azeemering</dc:creator>
      <dc:date>2020-10-19T16:24:43Z</dc:date>
    </item>
    <item>
      <title>Re: Extract second instance of IP address</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-second-instance-of-IP-address/m-p/525502#M148310</link>
      <description>&lt;P&gt;Worked like a charm, irrespective of the log format&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/80737"&gt;@inventsekar&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2020 06:46:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-second-instance-of-IP-address/m-p/525502#M148310</guid>
      <dc:creator>Pmeiring</dc:creator>
      <dc:date>2020-10-20T06:46:40Z</dc:date>
    </item>
  </channel>
</rss>

