<?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 for variable extraction in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-variable-extraction/m-p/420785#M120907</link>
    <description>&lt;P&gt;&lt;CODE&gt;V1 = 50.99.220.89 v2 = abcdef.us:12345&lt;/CODE&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 12 Jun 2019 19:52:27 GMT</pubDate>
    <dc:creator>reverse</dc:creator>
    <dc:date>2019-06-12T19:52:27Z</dc:date>
    <item>
      <title>Regex for variable extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-variable-extraction/m-p/420772#M120894</link>
      <description>&lt;P&gt;&lt;STRONG&gt;50.99.220.89&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;
&lt;CODE&gt;- 50.99.248.89 - - [12/Jun/2019:08:27:13 -0400] "POST /ccc67/JJ/U7UY/BCFUVGYUYGI11HTTP/1.1" 500 6629&lt;/CODE&gt; &lt;BR /&gt;
&lt;STRONG&gt;&lt;EM&gt;abcdef.us12345&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;v1&lt;/STRONG&gt;&lt;BR /&gt;
&lt;STRONG&gt;&lt;EM&gt;v2&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;How can I extract v1 and v2 from the events? &lt;BR /&gt;
v2 always starts with abc and has 5 digit port number.&lt;BR /&gt;
Please guide, thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 17:00:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-for-variable-extraction/m-p/420772#M120894</guid>
      <dc:creator>reverse</dc:creator>
      <dc:date>2019-06-12T17:00:18Z</dc:date>
    </item>
    <item>
      <title>Re: Regex for variable extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-variable-extraction/m-p/420773#M120895</link>
      <description>&lt;P&gt;what is v1 in your example , is it 1.1? and what is value of v2 in above example? &lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 17:03:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-for-variable-extraction/m-p/420773#M120895</guid>
      <dc:creator>Vijeta</dc:creator>
      <dc:date>2019-06-12T17:03:35Z</dc:date>
    </item>
    <item>
      <title>Re: Regex for variable extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-variable-extraction/m-p/420774#M120896</link>
      <description>&lt;P&gt;Hi reverese,&lt;BR /&gt;
Can you please modify your question using a backtick character before and after your sample line?&lt;BR /&gt;
But here's what you can do with the rex command:&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE&gt;| rex "^(?&amp;lt;v1&amp;gt;\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}).*(?&amp;lt;v2&amp;gt;abc\S+\d{5})$"&lt;/CODE&gt;&lt;/PRE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 17:05:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-for-variable-extraction/m-p/420774#M120896</guid>
      <dc:creator>jnudell_2</dc:creator>
      <dc:date>2019-06-12T17:05:39Z</dc:date>
    </item>
    <item>
      <title>Re: Regex for variable extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-variable-extraction/m-p/420775#M120897</link>
      <description>&lt;P&gt;Use the backtick before and after your line to show all special characters&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 17:06:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-for-variable-extraction/m-p/420775#M120897</guid>
      <dc:creator>jnudell_2</dc:creator>
      <dc:date>2019-06-12T17:06:41Z</dc:date>
    </item>
    <item>
      <title>Re: Regex for variable extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-variable-extraction/m-p/420776#M120898</link>
      <description>&lt;P&gt;abcdef.us12345&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 17:08:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-for-variable-extraction/m-p/420776#M120898</guid>
      <dc:creator>reverse</dc:creator>
      <dc:date>2019-06-12T17:08:49Z</dc:date>
    </item>
    <item>
      <title>Re: Regex for variable extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-variable-extraction/m-p/420777#M120899</link>
      <description>&lt;P&gt;abcdef.us:12345&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 17:09:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-for-variable-extraction/m-p/420777#M120899</guid>
      <dc:creator>reverse</dc:creator>
      <dc:date>2019-06-12T17:09:01Z</dc:date>
    </item>
    <item>
      <title>Re: Regex for variable extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-variable-extraction/m-p/420778#M120900</link>
      <description>&lt;P&gt;updated.. thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 17:10:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-for-variable-extraction/m-p/420778#M120900</guid>
      <dc:creator>reverse</dc:creator>
      <dc:date>2019-06-12T17:10:57Z</dc:date>
    </item>
    <item>
      <title>Re: Regex for variable extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-variable-extraction/m-p/420779#M120901</link>
      <description>&lt;P&gt;can I use single rex to extract both v1 and v2 for each raw line ?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 17:32:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-for-variable-extraction/m-p/420779#M120901</guid>
      <dc:creator>reverse</dc:creator>
      <dc:date>2019-06-12T17:32:08Z</dc:date>
    </item>
    <item>
      <title>Re: Regex for variable extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-variable-extraction/m-p/420780#M120902</link>
      <description>&lt;P&gt;yes you can&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 17:33:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-for-variable-extraction/m-p/420780#M120902</guid>
      <dc:creator>Vijeta</dc:creator>
      <dc:date>2019-06-12T17:33:50Z</dc:date>
    </item>
    <item>
      <title>Re: Regex for variable extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-variable-extraction/m-p/420781#M120903</link>
      <description>&lt;P&gt;Please guide with the  mentioned example raw event &lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 18:04:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-for-variable-extraction/m-p/420781#M120903</guid>
      <dc:creator>reverse</dc:creator>
      <dc:date>2019-06-12T18:04:10Z</dc:date>
    </item>
    <item>
      <title>Re: Regex for variable extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-variable-extraction/m-p/420782#M120904</link>
      <description>&lt;P&gt;In most cases, yes.  Could you clarify what v1 is and what v2 is in your raw line?  Is v1 an ip address?  Give me an example of v1 and v2.  Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 19:09:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-for-variable-extraction/m-p/420782#M120904</guid>
      <dc:creator>jnudell_2</dc:creator>
      <dc:date>2019-06-12T19:09:43Z</dc:date>
    </item>
    <item>
      <title>Re: Regex for variable extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-variable-extraction/m-p/420783#M120905</link>
      <description>&lt;P&gt;I found the solution.. just added two rex .. it worked. Able to use both variables in my stats command&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 19:35:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-for-variable-extraction/m-p/420783#M120905</guid>
      <dc:creator>reverse</dc:creator>
      <dc:date>2019-06-12T19:35:42Z</dc:date>
    </item>
    <item>
      <title>Re: Regex for variable extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-variable-extraction/m-p/420784#M120906</link>
      <description>&lt;P&gt;Ok, but if &lt;CODE&gt;v1 = abcdef.us12345&lt;/CODE&gt; and &lt;CODE&gt;v2 = abcdef.us:12345&lt;/CODE&gt; do you really need to differentiate between v1 &amp;amp; v2, or are you just trying to capture the data?&lt;/P&gt;

&lt;P&gt;If you don't care you would use:&lt;BR /&gt;
&lt;CODE&gt;| rex ".*(?&amp;lt;v1&amp;gt;abc\S+\d{1,5})$"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;If you &lt;EM&gt;DO&lt;/EM&gt; care then you would use:&lt;BR /&gt;
&lt;CODE&gt;| rex ".*(?&amp;lt;v2&amp;gt;abc[^:]+:\d{1,5})|(?&amp;lt;v1&amp;gt;abc\S+\d{1,5})$"&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 19:44:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-for-variable-extraction/m-p/420784#M120906</guid>
      <dc:creator>jnudell_2</dc:creator>
      <dc:date>2019-06-12T19:44:34Z</dc:date>
    </item>
    <item>
      <title>Re: Regex for variable extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-variable-extraction/m-p/420785#M120907</link>
      <description>&lt;P&gt;&lt;CODE&gt;V1 = 50.99.220.89 v2 = abcdef.us:12345&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 19:52:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-for-variable-extraction/m-p/420785#M120907</guid>
      <dc:creator>reverse</dc:creator>
      <dc:date>2019-06-12T19:52:27Z</dc:date>
    </item>
    <item>
      <title>Re: Regex for variable extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-variable-extraction/m-p/420786#M120908</link>
      <description>&lt;P&gt;Much clearer... Definitely no need for 2 rex statements for that.  The one I provided above in the answer works on that.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 20:40:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-for-variable-extraction/m-p/420786#M120908</guid>
      <dc:creator>jnudell_2</dc:creator>
      <dc:date>2019-06-12T20:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: Regex for variable extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-variable-extraction/m-p/420787#M120909</link>
      <description>&lt;P&gt;i have rex like - rex "(?xxxx|yyyy)"&lt;/P&gt;

&lt;P&gt;When using stats by action .. my results are dividing  by xxxx and yyyy.&lt;/P&gt;

&lt;P&gt;How can I avoid this separation?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 21:25:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-for-variable-extraction/m-p/420787#M120909</guid>
      <dc:creator>reverse</dc:creator>
      <dc:date>2019-06-12T21:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: Regex for variable extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-variable-extraction/m-p/420788#M120910</link>
      <description>&lt;P&gt;You'll need to write that more clearly, and use the backticks around your rex statement so special characters don't get removed.&lt;/P&gt;

&lt;P&gt;What's the whole search?  And what does an event look like for that search where the rex matches?&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2019 04:38:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-for-variable-extraction/m-p/420788#M120910</guid>
      <dc:creator>jnudell_2</dc:creator>
      <dc:date>2019-06-13T04:38:45Z</dc:date>
    </item>
  </channel>
</rss>

