<?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: Need help with regex in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Need-help-with-regex/m-p/180184#M51892</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;

&lt;P&gt;You should post full events samples, as the boundaries are important to define a proper regex&lt;/P&gt;

&lt;P&gt;Regards&lt;/P&gt;</description>
    <pubDate>Fri, 09 Jan 2015 12:06:47 GMT</pubDate>
    <dc:creator>gfuente</dc:creator>
    <dc:date>2015-01-09T12:06:47Z</dc:date>
    <item>
      <title>Need help with regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-with-regex/m-p/180182#M51890</link>
      <description>&lt;P&gt;I am trying to extract different error messages out of raw server log events. Below are the examples of different types of errors i am trying to extract.&lt;/P&gt;

&lt;P&gt;ClassNotFoundException&lt;/P&gt;

&lt;P&gt;java.io.IOException: No space left on device&lt;/P&gt;

&lt;P&gt;Caused by: java.net.SocketException: Connection reset&lt;/P&gt;

&lt;P&gt;Error - ORA-00942: table or view does not exist&lt;/P&gt;

&lt;P&gt;java.lang.OutOfMemoryError: GC overhead limit exceeded&lt;/P&gt;

&lt;P&gt;db connection hold time exceeds threshold [60000] ms &lt;/P&gt;

&lt;P&gt;Caused by: java.sql.SQLRecoverableException: IO Error&lt;/P&gt;

&lt;P&gt;java.lang.OutOfMemoryError&lt;/P&gt;

&lt;P&gt;java.sql.SQLRecoverableException: Closed Connection&lt;/P&gt;

&lt;P&gt;No ManagedConnections available within&lt;/P&gt;

&lt;P&gt;Regex for ClassNotFoundException is something I got working. But I am having difficulty with others since they are having white space,colons,periods etc and I am no expert with regular expressions :(.&lt;/P&gt;

&lt;P&gt;Any help/suggestions answers will be greatly appreciated.&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Amith&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jan 2015 12:00:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-with-regex/m-p/180182#M51890</guid>
      <dc:creator>amithhegde</dc:creator>
      <dc:date>2015-01-09T12:00:09Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-with-regex/m-p/180183#M51891</link>
      <description>&lt;P&gt;rex field=_raw "\b(?[\w]+assNotFoundException)" is regex i have written for ClassNotFoundException&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jan 2015 12:01:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-with-regex/m-p/180183#M51891</guid>
      <dc:creator>amithhegde</dc:creator>
      <dc:date>2015-01-09T12:01:40Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-with-regex/m-p/180184#M51892</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;

&lt;P&gt;You should post full events samples, as the boundaries are important to define a proper regex&lt;/P&gt;

&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jan 2015 12:06:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-with-regex/m-p/180184#M51892</guid>
      <dc:creator>gfuente</dc:creator>
      <dc:date>2015-01-09T12:06:47Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-with-regex/m-p/180185#M51893</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;No ManagedConnections available Error 

21:58:17,552 ERROR [STDERR] [10.10.70.11] Caused by: org.jboss.util.NestedSQLException: No ManagedConnections available within configured blocking timeout ( 30000 [ms] ); - nested throwable: (javax.resource.ResourceException: No ManagedConnections available within configured blocking timeout ( 30000 [ms] ))

 21:58:17,479 ERROR [STDERR] [10.10.70.11] Caused by: javax.ejb.EJBException: org.jboss.util.NestedSQLException: No ManagedConnections available within configured blocking timeout ( 30000 [ms] ); - nested throwable: (javax.resource.ResourceException: No ManagedConnections available within configured blocking timeout ( 30000 [ms] ))

 21:58:12,629 ERROR [STDERR] [10.10.70.11] Caused by: javax.resource.ResourceException: No ManagedConnections available within configured blocking timeout ( 30000 [ms] )
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Jan 2015 12:34:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-with-regex/m-p/180185#M51893</guid>
      <dc:creator>amithhegde</dc:creator>
      <dc:date>2015-01-09T12:34:48Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-with-regex/m-p/180186#M51894</link>
      <description>&lt;P&gt;java.io.IOException: No space left on device error.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;10:50:50.000 AM 
10:50:50,246 ERROR [JBossWeb] Problem in init 
java.io.IOException: No space left on device
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(FileOutputStream.java:310)
at org.jboss.util.file.JarUtils.unjar(JarUtils.java:313)
at org.jboss.web.AbstractWebContainer.init(AbstractWebContainer.java:325)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Jan 2015 12:37:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-with-regex/m-p/180186#M51894</guid>
      <dc:creator>amithhegde</dc:creator>
      <dc:date>2015-01-09T12:37:09Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-with-regex/m-p/180187#M51895</link>
      <description>&lt;P&gt;What data are you trying to get from the events?  The desired level of detail will have an effect on the regex.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jan 2015 12:41:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-with-regex/m-p/180187#M51895</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-01-09T12:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-with-regex/m-p/180188#M51896</link>
      <description>&lt;P&gt;Could you give a few examples of log files (pastebin?) and what exactly it is you'd like to have extracted?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jan 2015 12:54:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-with-regex/m-p/180188#M51896</guid>
      <dc:creator>lcrielaa</dc:creator>
      <dc:date>2015-01-09T12:54:05Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-with-regex/m-p/180189#M51897</link>
      <description>&lt;P&gt;Just in general, while working with regex I find the following two resources very helpful&lt;/P&gt;

&lt;P&gt;A regex tester on &lt;A href="https://www.regex101.com/"&gt;www.regex101.com&lt;/A&gt; and a tutorial on  &lt;A href="http://www.rexegg.com/regex-quickstart.html"&gt;www.rexegg.com&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jan 2015 13:20:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-with-regex/m-p/180189#M51897</guid>
      <dc:creator>FritzWittwer_ol</dc:creator>
      <dc:date>2015-01-09T13:20:20Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-with-regex/m-p/180190#M51898</link>
      <description>&lt;P&gt;I would add &lt;A href="http://www.regexr.com/"&gt;www.regexr.com&lt;/A&gt; to that list.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jan 2015 13:32:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-with-regex/m-p/180190#M51898</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-01-09T13:32:21Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-with-regex/m-p/180191#M51899</link>
      <description>&lt;P&gt;Some very basic regex you can run in the search box:&lt;/P&gt;

&lt;P&gt;This is by NO means the best regex for your data, just an example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=yourindex | rex ".+init\s+(?&amp;lt;Call_me_whatever_you_want&amp;gt;.+)\s+at"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So the &lt;CODE&gt;call_me_whatever_you_want&lt;/CODE&gt; will be your field name.&lt;/P&gt;

&lt;P&gt;It's important to understand a bit about regex and how Splunk uses it at search time:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;rex&lt;/CODE&gt; is the command you will to tell Splunk you want to use regex on the data that comes into that pipe.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;.+init&lt;/CODE&gt; is saying find everything (The &lt;CODE&gt;.+&lt;/CODE&gt;) up to the word &lt;CODE&gt;init&lt;/CODE&gt;. followed by whitespaces &lt;CODE&gt;\s+&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;(?&lt;/CODE&gt; this is when you start to tell splunk that after the &lt;CODE&gt;init&lt;/CODE&gt;, you want to make a field.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;.+)&lt;/CODE&gt; After the &amp;gt; in the above, type what you want to see in that field. Work out the regex which covers everyone of your errors. You can see I've just typed &lt;CODE&gt;.+&lt;/CODE&gt; again this will highlight EVERYTHING after the &lt;CODE&gt;init&lt;/CODE&gt;. &lt;CODE&gt;")&lt;/CODE&gt; just tells splunk your finished with that field.&lt;/P&gt;

&lt;P&gt;Now you need to tell splunk what appears after the data that you want. I have done it like this: &lt;CODE&gt;\s+at"&lt;/CODE&gt; because that particular java IO error is ended by some whitespaces &lt;CODE&gt;/s+&lt;/CODE&gt; followed by the word &lt;CODE&gt;at&lt;/CODE&gt;. &lt;/P&gt;

&lt;P&gt;Hopefully this will give you a basic idea of how to use it. Also try resources like &lt;A href="http://www.regex101.com"&gt;http://www.regex101.com&lt;/A&gt; as this is a great sandbox for testing what you write(It will not recognise the Splunk fields though "(?)".&lt;/P&gt;

&lt;P&gt;Alternatively, try the Splunk build in field extractor - that's quite handy and it does it for you!&lt;/P&gt;

&lt;P&gt;Hope this helps&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jan 2015 13:32:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-with-regex/m-p/180191#M51899</guid>
      <dc:creator>kendrickt</dc:creator>
      <dc:date>2015-01-09T13:32:56Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-with-regex/m-p/180192#M51900</link>
      <description>&lt;P&gt;Hi Icrielaa,&lt;/P&gt;

&lt;P&gt;I have provided the snippet of logs in the comments, what I want to extract is the error messages of the events "No ManagedConnections available within configured blocking timeout" and "java.io.IOException: No space left on device".&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Amith&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jan 2015 13:40:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-with-regex/m-p/180192#M51900</guid>
      <dc:creator>amithhegde</dc:creator>
      <dc:date>2015-01-09T13:40:51Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-with-regex/m-p/180193#M51901</link>
      <description>&lt;P&gt;@richgalloway One thing to be careful of here is that regexr.com uses Javascript regex whereas regex101 lets you choose your flavor; the differences may be nuanced but there it is worth it to use a tool that also uses perl compatible regular expressions (PCRE).&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jan 2015 17:06:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-with-regex/m-p/180193#M51901</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2015-01-09T17:06:22Z</dc:date>
    </item>
  </channel>
</rss>

