<?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: Help with regular expression in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regular-expression/m-p/458735#M129530</link>
    <description>&lt;P&gt;Hi nanachu,&lt;/P&gt;

&lt;P&gt;If you want to create an alert then you can do something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=main sourcetype=text
|rex field=title "\[(?&amp;lt;description&amp;gt;.*)\]"
|stats count by description
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(it will count the number of "[SUCCESS]", "[FAILED]", ... extracted)&lt;BR /&gt;
Then you click "save as" --&amp;gt; Alert --&amp;gt; Trigger alert when "Number of Results" is greater than 0&lt;/P&gt;

&lt;P&gt;Hope it helps&lt;/P&gt;

&lt;P&gt;Best regards,&lt;BR /&gt;
Adrian&lt;/P&gt;</description>
    <pubDate>Thu, 22 Aug 2019 10:22:32 GMT</pubDate>
    <dc:creator>Adrian_ftx</dc:creator>
    <dc:date>2019-08-22T10:22:32Z</dc:date>
    <item>
      <title>Help with regular expression</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regular-expression/m-p/458733#M129528</link>
      <description>&lt;P&gt;Hi, all&lt;/P&gt;

&lt;P&gt;I would like to create a mechanism that generates an alert when a regular expression extracted matches.&lt;/P&gt;

&lt;P&gt;However, I cannot come up with a search statement that says when the extracted regular expression matches a certain character.&lt;/P&gt;

&lt;P&gt;Here is my regular expression.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main sourcetype=text
|rex field = title(?&amp;lt;description&amp;gt;(\[).*(\]))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Field of title has values [SUCCESS],[FAILED],[SKIPPED]etc...&lt;/P&gt;

&lt;P&gt;I thought that this search statement would return results that matched SUCCESS.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main sourcetype=text
|rex field = title(?&amp;lt;description&amp;gt;(\[).*(\]))
description = "SUCCESS"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But, it does not work.&lt;/P&gt;

&lt;P&gt;Could you please help me?&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2019 01:40:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regular-expression/m-p/458733#M129528</guid>
      <dc:creator>nanachu</dc:creator>
      <dc:date>2019-08-22T01:40:55Z</dc:date>
    </item>
    <item>
      <title>Re: Help with regular expression</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regular-expression/m-p/458734#M129529</link>
      <description>&lt;P&gt;try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval title="[SUCCESS],[FAILED],[SKIPPED]" |rex field=title "\[+(?&amp;lt;status&amp;gt;.*?)\]" max_match=0
| mvexpand status
| where status="whatever you want"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;repalce whatever you want with success,failed,skipped etc...&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2019 10:18:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regular-expression/m-p/458734#M129529</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2019-08-22T10:18:37Z</dc:date>
    </item>
    <item>
      <title>Re: Help with regular expression</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regular-expression/m-p/458735#M129530</link>
      <description>&lt;P&gt;Hi nanachu,&lt;/P&gt;

&lt;P&gt;If you want to create an alert then you can do something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=main sourcetype=text
|rex field=title "\[(?&amp;lt;description&amp;gt;.*)\]"
|stats count by description
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(it will count the number of "[SUCCESS]", "[FAILED]", ... extracted)&lt;BR /&gt;
Then you click "save as" --&amp;gt; Alert --&amp;gt; Trigger alert when "Number of Results" is greater than 0&lt;/P&gt;

&lt;P&gt;Hope it helps&lt;/P&gt;

&lt;P&gt;Best regards,&lt;BR /&gt;
Adrian&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2019 10:22:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regular-expression/m-p/458735#M129530</guid>
      <dc:creator>Adrian_ftx</dc:creator>
      <dc:date>2019-08-22T10:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: Help with regular expression</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regular-expression/m-p/458736#M129531</link>
      <description>&lt;P&gt;hi @nanachu &lt;BR /&gt;
Can you please check and confirm on your issue? Please accept the answer if it significantly helped resolve your issue. Do not forget to add/modify the answer if you did some modifications and then accept the answer.&lt;/P&gt;</description>
      <pubDate>Sat, 24 Aug 2019 07:47:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regular-expression/m-p/458736#M129531</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2019-08-24T07:47:58Z</dc:date>
    </item>
    <item>
      <title>Re: Help with regular expression</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regular-expression/m-p/458737#M129532</link>
      <description>&lt;P&gt;You can use the &lt;CODE&gt;| regex&lt;/CODE&gt; to search events regex patterns without the need to extract fields. &lt;/P&gt;

&lt;P&gt;Example: &lt;BR /&gt;
if you want to get an alert when there is a [FAILED] event you can search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main sourcetype=text
| regex _raw="\[FAILED\]"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;NOTE: You can swap _raw by other existing field if you want.&lt;/P&gt;

&lt;P&gt;More information on the regex command:&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.3.1/Search/SPLandregularexpressions"&gt;https://docs.splunk.com/Documentation/Splunk/7.3.1/Search/SPLandregularexpressions&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Also check this .conf presentation:&lt;BR /&gt;
&lt;A href="https://conf.splunk.com/files/2017/slides/regex-in-your-spl.pdf"&gt;https://conf.splunk.com/files/2017/slides/regex-in-your-spl.pdf&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 25 Aug 2019 00:05:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regular-expression/m-p/458737#M129532</guid>
      <dc:creator>diogofgm</dc:creator>
      <dc:date>2019-08-25T00:05:32Z</dc:date>
    </item>
  </channel>
</rss>

