<?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 a specific IP with positive lookahead in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/extract-a-specific-IP-with-positive-lookahead/m-p/528818#M89123</link>
    <description>&lt;P&gt;I got my solution tha works:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so first, when I want&lt;STRONG&gt; to capture a specific IP out of many&lt;/STRONG&gt; I need my positive Lookahead with (?=\...)&lt;/P&gt;&lt;P&gt;so the src_ip regex is therefore:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(?P&amp;lt;src_ip&amp;gt;\d*\.\d*\.\d*\.\d*)(?=\ \d* TCP_)&lt;/LI-CODE&gt;&lt;P&gt;this makes sure that I capture the ip which has some numbers after a blank and then a TCP_ after another blank space.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;to capture many different groups&lt;/STRONG&gt; I just had to account for the blank spaces between the different values with \s and then start with my capture group again. :&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(?P&amp;lt;src_ip&amp;gt;\d*\.\d*\.\d*\.\d*)(?=\ \d* TCP_)\s(?P&amp;lt;bits&amp;gt;\d*)\s(?P&amp;lt;tcp_state&amp;gt;\w*_\w*)
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 10 Nov 2020 12:15:09 GMT</pubDate>
    <dc:creator>avoelk</dc:creator>
    <dc:date>2020-11-10T12:15:09Z</dc:date>
    <item>
      <title>extract a specific IP with positive lookahead</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/extract-a-specific-IP-with-positive-lookahead/m-p/528561#M89106</link>
      <description>&lt;P&gt;I'm trying to extract multiple fields out of my log. my problem is that I do have multiplie ip adresses - one for the source, one from the webserver etc. so to counter having extracted four ip adresses in every event into the same field I want to use a positive lookahead to tell the regex "yes this ip but only if afterwards there comes x and y"&lt;/P&gt;&lt;P&gt;this is an example log:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;2014-03-27 23:54:58 1 10.5.6.121 304 TCP_HIT 422 501 GET http assets.razerzone.com 80 /eeimages/products/13785/razer-naga-2014-right-03.png - - - - 54.230.18.168 image/png http://imgur.com/gallery/u3o7l "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Iron/31.0.1700.0 Chrome/31.0.1700.0 Safari/537.36" OBSERVED "Technology/Internet;Shopping" - 163.252.254.203 - 54351
2014-03-28 23:54:59 90670 10.62.0.120 200 TCP_NC_MISS 601 693 GET http realtime.services.disqus.com 80 /api/2/thread/2221828111 ?bust=1780 - - - realtime.services.disqus.com application/json http://disqus.com/embed/comments/?base=default&amp;amp;disqus_version=6c05c0ca&amp;amp;f=bootsnipp&amp;amp;t_i=9WgD&amp;amp;t_u=http%3A%2F%2Fbootsnipp.com%2Fsnippets%2Ffeatured%2Fminimal-preview-thumbnails&amp;amp;t_d=Viewing%20snippet%20Minimal%20Preview%20Thumbnails%20%7C%20Bootsnipp.com&amp;amp;t_t=Viewing%20snippet%20Minimal%20Preview%20Thumbnails%20%7C%20Bootsnipp.com&amp;amp;s_o=default "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36" OBSERVED "Newsgroups/Forums" - 163.252.254.203 184.173.90.195 52401&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here I want&amp;nbsp; for example extract the source_ip (the first ip in the event) like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(\d+\.\d+\.\d+\.\d+)[[:blank:]](?=\d*)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;still this gives me many other ips... so I think I have to use multiple lookaheads? but I really don't know how to use it in that case. Especially when I want to extract the ip and give it a field name. In my head this means that I have to encapsulate EVERYTHING including the lookaheads ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks a lot for your help!&lt;/P&gt;</description>
      <pubDate>Mon, 09 Nov 2020 17:10:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/extract-a-specific-IP-with-positive-lookahead/m-p/528561#M89106</guid>
      <dc:creator>avoelk</dc:creator>
      <dc:date>2020-11-09T17:10:16Z</dc:date>
    </item>
    <item>
      <title>Re: extract a specific IP with positive lookahead</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/extract-a-specific-IP-with-positive-lookahead/m-p/528818#M89123</link>
      <description>&lt;P&gt;I got my solution tha works:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so first, when I want&lt;STRONG&gt; to capture a specific IP out of many&lt;/STRONG&gt; I need my positive Lookahead with (?=\...)&lt;/P&gt;&lt;P&gt;so the src_ip regex is therefore:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(?P&amp;lt;src_ip&amp;gt;\d*\.\d*\.\d*\.\d*)(?=\ \d* TCP_)&lt;/LI-CODE&gt;&lt;P&gt;this makes sure that I capture the ip which has some numbers after a blank and then a TCP_ after another blank space.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;to capture many different groups&lt;/STRONG&gt; I just had to account for the blank spaces between the different values with \s and then start with my capture group again. :&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(?P&amp;lt;src_ip&amp;gt;\d*\.\d*\.\d*\.\d*)(?=\ \d* TCP_)\s(?P&amp;lt;bits&amp;gt;\d*)\s(?P&amp;lt;tcp_state&amp;gt;\w*_\w*)
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Nov 2020 12:15:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/extract-a-specific-IP-with-positive-lookahead/m-p/528818#M89123</guid>
      <dc:creator>avoelk</dc:creator>
      <dc:date>2020-11-10T12:15:09Z</dc:date>
    </item>
  </channel>
</rss>

