<?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 Help with regex / replace needed in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-replace-needed/m-p/425231#M172691</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I have the following event:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;X Mon Mar  4 19:57:48:935 2019 X  *** WARNING =&amp;gt; MMX 'EGPH5': mm_diagmode set 0 118: possible performance degradation #102400
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;WARNING could be also ERROR, I would like to handle both cases in one regex.&lt;/P&gt;

&lt;P&gt;Now, I would like to:&lt;BR /&gt;
1/ Skip the line beginning until the word WARNING / ERROR&lt;BR /&gt;
2/ clear the event from all digits&lt;BR /&gt;
3/ save the result into the "text"&lt;/P&gt;

&lt;P&gt;For the digit clearing I have the following replace:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval text=replace(_raw,"\d{0}\d+","")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and it works fine. However I have issues with the skipping line until WARNING / ERROR. If I take the regex101, then the corresponding sed would be:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;s/^(.*)\* //g
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but when I apply it in the Splunk SPL it will do nothing:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex mode=sed "s/^(.*)\*//g"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;.. not mentioning trying above in replace.&lt;/P&gt;

&lt;P&gt;Could you please advice?&lt;BR /&gt;
How would I skip the beginning of line and clear it from digits and assign to the text? Replace or sed, does not matter.&lt;/P&gt;

&lt;P&gt;Kind Regards,&lt;BR /&gt;
Kamil&lt;/P&gt;</description>
    <pubDate>Thu, 07 Mar 2019 09:56:19 GMT</pubDate>
    <dc:creator>damucka</dc:creator>
    <dc:date>2019-03-07T09:56:19Z</dc:date>
    <item>
      <title>Help with regex / replace needed</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-replace-needed/m-p/425231#M172691</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I have the following event:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;X Mon Mar  4 19:57:48:935 2019 X  *** WARNING =&amp;gt; MMX 'EGPH5': mm_diagmode set 0 118: possible performance degradation #102400
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;WARNING could be also ERROR, I would like to handle both cases in one regex.&lt;/P&gt;

&lt;P&gt;Now, I would like to:&lt;BR /&gt;
1/ Skip the line beginning until the word WARNING / ERROR&lt;BR /&gt;
2/ clear the event from all digits&lt;BR /&gt;
3/ save the result into the "text"&lt;/P&gt;

&lt;P&gt;For the digit clearing I have the following replace:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval text=replace(_raw,"\d{0}\d+","")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and it works fine. However I have issues with the skipping line until WARNING / ERROR. If I take the regex101, then the corresponding sed would be:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;s/^(.*)\* //g
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but when I apply it in the Splunk SPL it will do nothing:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex mode=sed "s/^(.*)\*//g"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;.. not mentioning trying above in replace.&lt;/P&gt;

&lt;P&gt;Could you please advice?&lt;BR /&gt;
How would I skip the beginning of line and clear it from digits and assign to the text? Replace or sed, does not matter.&lt;/P&gt;

&lt;P&gt;Kind Regards,&lt;BR /&gt;
Kamil&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2019 09:56:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-replace-needed/m-p/425231#M172691</guid>
      <dc:creator>damucka</dc:creator>
      <dc:date>2019-03-07T09:56:19Z</dc:date>
    </item>
    <item>
      <title>Re: Help with regex / replace needed</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-replace-needed/m-p/425232#M172692</link>
      <description>&lt;P&gt;Hi @damucka&lt;/P&gt;

&lt;P&gt;Try like and please let me know sample output that you want&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="X Mon Mar  4 19:57:48:935 2019 X  *** WARNING =&amp;gt; MMX 'EGPH5': mm_diagmode set 0 118: possible performance degradation #102400" 
| eval text=replace(_raw,"\d{0}\d+","")| rex field=text mode=sed "s/^(.*)\*//g"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Mar 2019 10:07:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-replace-needed/m-p/425232#M172692</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2019-03-07T10:07:47Z</dc:date>
    </item>
    <item>
      <title>Re: Help with regex / replace needed</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-replace-needed/m-p/425233#M172693</link>
      <description>&lt;P&gt;What about this:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;|makeresults | eval _raw = "X Mon Mar  4 19:57:48:935 2019 X  *** WARNING =&amp;gt; MMX 'EGPH5': mm_diagmode set 0 118: possible performance degradation #102400" | rex mode=sed field=_raw "s/\d+//" |rex mode=sed "s/^(.*?)\*+//g"&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2019 10:08:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-replace-needed/m-p/425233#M172693</guid>
      <dc:creator>chrisyounger</dc:creator>
      <dc:date>2019-03-07T10:08:15Z</dc:date>
    </item>
  </channel>
</rss>

