<?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 Extract string between 2 string in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Extract-string-between-2-string/m-p/424667#M121779</link>
    <description>&lt;P&gt;Hi Community,&lt;/P&gt;

&lt;P&gt;I have a question about regex and extraction&lt;/P&gt;

&lt;P&gt;I want to extract only the string between /var/log/nginx/access_  and .log&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/5635iE498085A8AE789B8/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;I already tried many regex en mod=sed but i don't find the right regex.&lt;/P&gt;

&lt;P&gt;Can you help me ?&lt;/P&gt;

&lt;P&gt;Many thanks&lt;/P&gt;</description>
    <pubDate>Thu, 23 Aug 2018 12:07:49 GMT</pubDate>
    <dc:creator>serviceinfrastr</dc:creator>
    <dc:date>2018-08-23T12:07:49Z</dc:date>
    <item>
      <title>Extract string between 2 string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-string-between-2-string/m-p/424667#M121779</link>
      <description>&lt;P&gt;Hi Community,&lt;/P&gt;

&lt;P&gt;I have a question about regex and extraction&lt;/P&gt;

&lt;P&gt;I want to extract only the string between /var/log/nginx/access_  and .log&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/5635iE498085A8AE789B8/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;I already tried many regex en mod=sed but i don't find the right regex.&lt;/P&gt;

&lt;P&gt;Can you help me ?&lt;/P&gt;

&lt;P&gt;Many thanks&lt;/P&gt;</description>
      <pubDate>Thu, 23 Aug 2018 12:07:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-string-between-2-string/m-p/424667#M121779</guid>
      <dc:creator>serviceinfrastr</dc:creator>
      <dc:date>2018-08-23T12:07:49Z</dc:date>
    </item>
    <item>
      <title>Re: Extract string between 2 string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-string-between-2-string/m-p/424668#M121780</link>
      <description>&lt;P&gt;@serviceinfrastructure,&lt;/P&gt;

&lt;P&gt;Try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; |rex  field=URL "^/\w+/\w+/\w+/\w+_(?P&amp;lt;my_string&amp;gt;[^\.]+)"|table my_string
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Aug 2018 13:08:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-string-between-2-string/m-p/424668#M121780</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2018-08-23T13:08:38Z</dc:date>
    </item>
    <item>
      <title>Re: Extract string between 2 string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-string-between-2-string/m-p/424669#M121781</link>
      <description>&lt;P&gt;Try this. Add this to your search,&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;search...| rex field=source "\/var\/log\/nginx\/access\_(?&amp;lt;string&amp;gt;\S+)\.log" | table string&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Tested regex &lt;A href="https://regex101.com/r/f2vA5M/1/"&gt;here&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Aug 2018 13:10:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-string-between-2-string/m-p/424669#M121781</guid>
      <dc:creator>sudosplunk</dc:creator>
      <dc:date>2018-08-23T13:10:57Z</dc:date>
    </item>
    <item>
      <title>Re: Extract string between 2 string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-string-between-2-string/m-p/424670#M121782</link>
      <description>&lt;P&gt;If you just need to extract a string then you don't need &lt;CODE&gt;sed&lt;/CODE&gt; as that is for modifying strings.&lt;BR /&gt;
Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=dnginx* NOT source="/var/log/nginx/access.log" NOT source="/var/log/nginx/error.log" | rex field=source "access_(?&amp;lt;string&amp;gt;[^\.]+)" | chart count by string | rename url_short as URL
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Aug 2018 13:12:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-string-between-2-string/m-p/424670#M121782</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2018-08-23T13:12:26Z</dc:date>
    </item>
    <item>
      <title>Re: Extract string between 2 string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-string-between-2-string/m-p/424671#M121783</link>
      <description>&lt;P&gt;@serviceinfrastructure ,&lt;/P&gt;

&lt;P&gt;You can use regex given by @richgalloway, as it takes, 13 steps to match the pattern and mine takes 38 steps. However, if you have many sources with &lt;CODE&gt;access_&lt;/CODE&gt; in the value, then you might want to be more specific in defining regex. &lt;/P&gt;</description>
      <pubDate>Thu, 23 Aug 2018 13:20:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-string-between-2-string/m-p/424671#M121783</guid>
      <dc:creator>sudosplunk</dc:creator>
      <dc:date>2018-08-23T13:20:23Z</dc:date>
    </item>
    <item>
      <title>Re: Extract string between 2 string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-string-between-2-string/m-p/424672#M121784</link>
      <description>&lt;P&gt;Hi @serviceinfrastructure  - Did your answer provide a working solution to your question? If yes, don't forget to click "Accept" to close out your question so that others can easily find it if they are having the same issue. Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 23 Aug 2018 21:38:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-string-between-2-string/m-p/424672#M121784</guid>
      <dc:creator>mstjohn_splunk</dc:creator>
      <dc:date>2018-08-23T21:38:15Z</dc:date>
    </item>
  </channel>
</rss>

