<?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: Optimize rex command in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Optimize-rex-command/m-p/467554#M131583</link>
    <description>&lt;P&gt;Your problem has nothing to do with limits; your problem is that your RegEx is wrong. Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex field=CDREASON "(?&amp;lt;grammar_error_reason&amp;gt;(?:Can not convert|Can't find the)\s+\w+)\s+(?:from here|segment)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 18 Dec 2019 15:32:33 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2019-12-18T15:32:33Z</dc:date>
    <item>
      <title>Optimize rex command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Optimize-rex-command/m-p/467552#M131581</link>
      <description>&lt;P&gt;Hi all, &lt;/P&gt;

&lt;P&gt;I want to extract fields form log events. &lt;/P&gt;

&lt;P&gt;I have two errors patterns : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;* Can not convert FOO from here ==&amp;gt; *
Can't find the FOO segment
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What i want is to create a field named grammar_error_reason that contain &lt;EM&gt;"Can not convert FOO"&lt;/EM&gt; or &lt;EM&gt;"Can't find the FOO segment"&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;Here is my rex command : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=CDREASON "Converted segments:(\s\w{3}+\s-)+\s(?&amp;lt;grammar_error_reason&amp;gt;.+) from here"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This command raise le limits of limits.conf. It take &lt;STRONG&gt;236 steps.&lt;/STRONG&gt; &lt;BR /&gt;
In the limits.conf file the rex limits are : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[rex]
match_limit = 100000
depth_limit = 1000
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Can you help me please. &lt;/P&gt;

&lt;P&gt;Kind regards, &lt;BR /&gt;
Clement&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:24:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Optimize-rex-command/m-p/467552#M131581</guid>
      <dc:creator>clementros</dc:creator>
      <dc:date>2020-09-30T03:24:06Z</dc:date>
    </item>
    <item>
      <title>Re: Optimize rex command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Optimize-rex-command/m-p/467553#M131582</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval CDREASON=" * Can not convert FOO from here ==&amp;gt; *
 Can't find the FOO segment"
| rex field=CDREASON max_match=100 "(Can not convert|Can't find the) (?&amp;lt;grammar_error_reason&amp;gt;\w+) (from here|segment)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;HI, @clementros&lt;BR /&gt;
How many lines per event?&lt;BR /&gt;
If there are more than 100 lines, increase &lt;CODE&gt;max_match&lt;/CODE&gt; values.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2019 11:53:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Optimize-rex-command/m-p/467553#M131582</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2019-12-18T11:53:03Z</dc:date>
    </item>
    <item>
      <title>Re: Optimize rex command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Optimize-rex-command/m-p/467554#M131583</link>
      <description>&lt;P&gt;Your problem has nothing to do with limits; your problem is that your RegEx is wrong. Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex field=CDREASON "(?&amp;lt;grammar_error_reason&amp;gt;(?:Can not convert|Can't find the)\s+\w+)\s+(?:from here|segment)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Dec 2019 15:32:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Optimize-rex-command/m-p/467554#M131583</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-12-18T15:32:33Z</dc:date>
    </item>
  </channel>
</rss>

