<?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 create a regex to extract values from an event? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-values-from-an-event/m-p/401986#M116318</link>
    <description>&lt;P&gt;yes their is this two possibilities and your expression : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"\\\\x\d\d;\d\s(?&amp;lt;first&amp;gt;\d)(?&amp;lt;second&amp;gt;\d)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Work very well !!! thank you so much ! &lt;/P&gt;

&lt;P&gt;Can you please re-send it so i can accept it ? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 06 Jun 2019 11:50:56 GMT</pubDate>
    <dc:creator>le_barbucheron</dc:creator>
    <dc:date>2019-06-06T11:50:56Z</dc:date>
    <item>
      <title>How to create a regex to extract values from an event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-values-from-an-event/m-p/401971#M116303</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;

&lt;P&gt;I'm struggling to find a REGEX to extract 2 value from my events. &lt;/P&gt;

&lt;P&gt;I got events like this : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2019-05-02 07:26:07.283;2019-05-02 05:26:07.283;2019-05-02 07:26:07.283;LOOKINGFORACTION;TO;SOMESTRING;FROM;SOMESTRING;MSG [223];\x00;0 22 0 0 0 0 0 8 0 0 0 0 0 0 0 2 FC 3E ;\x00;\x00;\x00;0;0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I was looking for a REGEX to extract this two values : &lt;/P&gt;

&lt;P&gt;0 &lt;STRONG&gt;2&lt;/STRONG&gt; 2 0 0 0 0 0 8 0 0 0 0 0 0 0 2 FC 3E&lt;BR /&gt;
and &lt;BR /&gt;
0 2 &lt;STRONG&gt;2&lt;/STRONG&gt; 0 0 0 0 0 8 0 0 0 0 0 0 0 2 FC 3E&lt;/P&gt;

&lt;P&gt;But I don't know how write the right REGEX.&lt;/P&gt;

&lt;P&gt;Thank you for reading and thank you in advance for your answers.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jun 2019 08:22:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-values-from-an-event/m-p/401971#M116303</guid>
      <dc:creator>le_barbucheron</dc:creator>
      <dc:date>2019-06-03T08:22:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a regex to extract values from an event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-values-from-an-event/m-p/401972#M116304</link>
      <description>&lt;P&gt;Hi @le_barbucheron,&lt;/P&gt;

&lt;P&gt;Is &lt;A href="https://regex101.com/r/hDbPlD/4"&gt;this&lt;/A&gt; what you are looking for.&lt;/P&gt;

&lt;P&gt;Edit: Updated the regex in the link for two possible cases you mentioned&lt;BR /&gt;
Also,&lt;BR /&gt;
Heres the search in Splunk which will work exactly like shown in the link:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=1 
| eval _raw = "2019-05-02 07:26:07.283;2019-05-02 05:26:07.283;2019-05-02 07:26:07.283;LOOKINGFORACTION;TO;SOMESTRING;FROM;SOMESTRING;MSG [223];\x00;0 22 0 0 0 0 0 8 0 0 0 0 0 0 0 2 FC 3E ;\x00;\x00;\x00;0;0" 
| rex field=_raw "\\\\\w\d\d;\d\s(?&amp;lt;first&amp;gt;\d)(?&amp;lt;second&amp;gt;[1-9]|\s\d)"

// with space example


| makeresults count=1 
| eval _raw = "2019-05-02 07:26:07.283;2019-05-02 05:26:07.283;2019-05-02 07:26:07.283;LOOKINGFORACTION;TO;SOMESTRING;FROM;SOMESTRING;MSG [223];\x00;0 0 4 0 0 0 0 0 0 8 0 0 0 0 0 0 0 2 FC 3E ;\x00;\x00;\x00;0;0" 
| rex field=_raw "\\\\\w\d\d;\d\s(?&amp;lt;first&amp;gt;\d)(?&amp;lt;second&amp;gt;[1-9]|\s\d)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 03 Jun 2019 12:14:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-values-from-an-event/m-p/401972#M116304</guid>
      <dc:creator>harshpatel</dc:creator>
      <dc:date>2019-06-03T12:14:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a regex to extract values from an event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-values-from-an-event/m-p/401973#M116305</link>
      <description>&lt;P&gt;Please post an additional sample, &lt;BR /&gt;
are the values you are showing only going to contain values between 0 and 9? Your original event has 22 instead of 2 2&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jun 2019 12:14:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-values-from-an-event/m-p/401973#M116305</guid>
      <dc:creator>martinpu</dc:creator>
      <dc:date>2019-06-03T12:14:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a regex to extract values from an event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-values-from-an-event/m-p/401974#M116306</link>
      <description>&lt;P&gt;I'd need to see more sample events to ensure this regex isn't too focused on one event, but this works:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;x00;\d\s(?&amp;lt;capturegroup1&amp;gt;\d)(?&amp;lt;capturegroup2&amp;gt;\d)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 03 Jun 2019 13:19:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-values-from-an-event/m-p/401974#M116306</guid>
      <dc:creator>martynoconnor</dc:creator>
      <dc:date>2019-06-03T13:19:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a regex to extract values from an event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-values-from-an-event/m-p/401975#M116307</link>
      <description>&lt;P&gt;Hi le_barbucheron,&lt;BR /&gt;
let me understand: do youi want the second numeric value in a field and the third one in another field?&lt;/P&gt;

&lt;P&gt;If this is your need, try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;^([^;]*;){10}\d\s(?P&amp;lt;Field1&amp;gt;\d)\s(?P&amp;lt;Field2&amp;gt;\d)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can test it at &lt;A href="https://regex101.com/r/7SRUfz/2"&gt;https://regex101.com/r/7SRUfz/2&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jun 2019 13:31:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-values-from-an-event/m-p/401975#M116307</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-06-03T13:31:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a regex to extract values from an event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-values-from-an-event/m-p/401976#M116308</link>
      <description>&lt;P&gt;Sorry, guys I don't know why I didn't get any notifications of your reply,&lt;/P&gt;

&lt;P&gt;Here's some more samples : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;     2019-05-02 08:29:05.225;2019-05-02 08:29:05.225;2019-05-02 07:29:05.225;LOOKINGFORACTION;TO;SOMESTRING;FROM;SOMESTRING;MSG [223];\x00;5 52 0 0 0 0 0 8 0 0 0 0 0 0 0 2 FC 3E ;\x00;\x00;\x00;0;0

     2019-05-03 09:32:12.552;2019-05-03 09:32:12.552;2019-05-02 09:32:12.552;LOOKINGFORACTION;TO;SOMESTRING;FROM;SOMESTRING;MSG [223];\x00;1 73 0 0 0 0 0 8 0 0 0 0 0 0 0 C CD 39 ;\x00;\x00;\x00;0;0

     2019-05-03 10:17:15.355;2019-05-03 10:17:15.355;2019-05-03 10:32:15.355;LOOKINGFORACTION;TO;SOMESTRING;FROM;SOMESTRING;MSG [223];\x00;0 02 0 0 0 0 0 8 0 0 0 0 0 0 0 1 89 10 ;\x00;\x00;\x00;0;0

     2019-05-03 11:16:03.012;2019-05-03 11:16:03.012;2019-05-03 11:16:06.012;LOOKINGFORACTION;TO;SOMESTRING;FROM;SOMESTRING;MSG [223];\x00;0 40 0 0 0 0 0 8 0 0 0 0 0 0 0 2 D8 B0 ;\x00;\x00;\x00;0;0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I tried the 3 propositions you made me and only the expression writed by @martynoconnor  get me a result but this result return me an empty value when the first number extracted is "0"&lt;/P&gt;

&lt;P&gt;Thank you for your answers ! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2019 13:06:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-values-from-an-event/m-p/401976#M116308</guid>
      <dc:creator>le_barbucheron</dc:creator>
      <dc:date>2019-06-05T13:06:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a regex to extract values from an event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-values-from-an-event/m-p/401977#M116309</link>
      <description>&lt;P&gt;Sure, I tried your answer but i don't know why this don't work on my events but this work perfectly on regex101 &lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2019 13:37:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-values-from-an-event/m-p/401977#M116309</guid>
      <dc:creator>le_barbucheron</dc:creator>
      <dc:date>2019-06-05T13:37:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a regex to extract values from an event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-values-from-an-event/m-p/401978#M116310</link>
      <description>&lt;P&gt;O, here is a little bit different take...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;^(.*;){9}\d\s(?P&amp;lt;Field1&amp;gt;\d)(?P&amp;lt;Field2&amp;gt;\d)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 05 Jun 2019 14:58:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-values-from-an-event/m-p/401978#M116310</guid>
      <dc:creator>mydog8it</dc:creator>
      <dc:date>2019-06-05T14:58:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a regex to extract values from an event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-values-from-an-event/m-p/401979#M116311</link>
      <description>&lt;P&gt;I just noticed the data in  gcusello's session in regex101 is different than the data provided in the post above. There is a space between the two fields to be captured gcusello's session in regex101. Does the original data have variances like this or is it consistently one way or the other?&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2019 15:16:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-values-from-an-event/m-p/401979#M116311</guid>
      <dc:creator>mydog8it</dc:creator>
      <dc:date>2019-06-05T15:16:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a regex to extract values from an event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-values-from-an-event/m-p/401980#M116312</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex "([\d,a-f,A-F]+\s+)(?&amp;lt;f1&amp;gt;[\d,a-f,A-F]+)\s+(?&amp;lt;f2&amp;gt;[\d,a-f,A-F]+)\s+([\d,a-f,A-F]+\s+){15}"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 05 Jun 2019 15:55:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-values-from-an-event/m-p/401980#M116312</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-06-05T15:55:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a regex to extract values from an event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-values-from-an-event/m-p/401981#M116313</link>
      <description>&lt;P&gt;Their is no space between the two value I need to extract, they'll always be grouped like my example&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2019 07:12:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-values-from-an-event/m-p/401981#M116313</guid>
      <dc:creator>le_barbucheron</dc:creator>
      <dc:date>2019-06-06T07:12:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a regex to extract values from an event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-values-from-an-event/m-p/401982#M116314</link>
      <description>&lt;P&gt;Oops sorry i was wrong,  when the value of the field are different of 0 their is no space but when the first are the second are at 0 their is a space, like this : &lt;/P&gt;

&lt;P&gt;0 4 0 0 0 0 0 0 8 0 0 0 0 0 0 0 2 D8 B0&lt;BR /&gt;
0 44 0 0 0 0 0 8 0 0 0 0 0 0 0 2 D8 B0&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2019 08:34:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-values-from-an-event/m-p/401982#M116314</guid>
      <dc:creator>le_barbucheron</dc:creator>
      <dc:date>2019-06-06T08:34:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a regex to extract values from an event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-values-from-an-event/m-p/401983#M116315</link>
      <description>&lt;P&gt;Thank you everybody, I think i'm going to use the regex wrote by @martynoconnor with the fillnull command to place the "0" values skipped,&lt;/P&gt;

&lt;P&gt;Again, thank you so much !&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2019 08:42:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-values-from-an-event/m-p/401983#M116315</guid>
      <dc:creator>le_barbucheron</dc:creator>
      <dc:date>2019-06-06T08:42:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a regex to extract values from an event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-values-from-an-event/m-p/401984#M116316</link>
      <description>&lt;P&gt;Can you please try this search and see if it works?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=1 
| eval _raw = "2019-05-02 07:26:07.283;2019-05-02 05:26:07.283;2019-05-02 07:26:07.283;LOOKINGFORACTION;TO;SOMESTRING;FROM;SOMESTRING;MSG [223];\x00;0 22 0 0 0 0 0 8 0 0 0 0 0 0 0 2 FC 3E ;\x00;\x00;\x00;0;0" 
| rex field=_raw "\\\\x\d\d;\d\s(?&amp;lt;first&amp;gt;\d)(?&amp;lt;second&amp;gt;\d)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Jun 2019 10:14:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-values-from-an-event/m-p/401984#M116316</guid>
      <dc:creator>harshpatel</dc:creator>
      <dc:date>2019-06-06T10:14:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a regex to extract values from an event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-values-from-an-event/m-p/401985#M116317</link>
      <description>&lt;P&gt;So theres two possibilities in your data?&lt;BR /&gt;
It can be 0 4 0 0 0 0 0 0 8 0 0 0 0 0 0 0 2 D8 B0&lt;BR /&gt;
OR 0 44 0 0 0 0 0 8 0 0 0 0 0 0 0 2 D8 B0&lt;/P&gt;

&lt;P&gt;Am I right?&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2019 11:40:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-values-from-an-event/m-p/401985#M116317</guid>
      <dc:creator>harshpatel</dc:creator>
      <dc:date>2019-06-06T11:40:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a regex to extract values from an event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-values-from-an-event/m-p/401986#M116318</link>
      <description>&lt;P&gt;yes their is this two possibilities and your expression : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"\\\\x\d\d;\d\s(?&amp;lt;first&amp;gt;\d)(?&amp;lt;second&amp;gt;\d)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Work very well !!! thank you so much ! &lt;/P&gt;

&lt;P&gt;Can you please re-send it so i can accept it ? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2019 11:50:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-values-from-an-event/m-p/401986#M116318</guid>
      <dc:creator>le_barbucheron</dc:creator>
      <dc:date>2019-06-06T11:50:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a regex to extract values from an event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-values-from-an-event/m-p/401987#M116319</link>
      <description>&lt;P&gt;@le_barbucheron Try this &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Cheers,&lt;BR /&gt;
Harsh&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2019 11:59:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-values-from-an-event/m-p/401987#M116319</guid>
      <dc:creator>harshpatel</dc:creator>
      <dc:date>2019-06-06T11:59:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a regex to extract values from an event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-values-from-an-event/m-p/401988#M116320</link>
      <description>&lt;P&gt;Did you accept the right one?  Did you mention the wrong person in this comment?&lt;/P&gt;</description>
      <pubDate>Sun, 09 Jun 2019 21:49:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-values-from-an-event/m-p/401988#M116320</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-06-09T21:49:16Z</dc:date>
    </item>
  </channel>
</rss>

