<?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 extract exception from stacktrace field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/extract-exception-from-stacktrace-field/m-p/529851#M149677</link>
    <description>&lt;P&gt;Below is a sample log message.&amp;nbsp; Each message will have string "500 Server Error for HTTP" and i need to extract 3 fields after the occurrence of "500 Server Error for HTTP" string&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;2020-11-18T00:32:37.632Z LCS userId=null LCE [helper-http-epoll-1] ERROR o.s.b.a.w.r.e.AbstractErrorWebExceptionHandler.error(122) - 500 Server Error for HTTP POST "/sports/v1/boxing"java.net.UnknownHostException: my-rest-service.backend--&amp;gt;	at java.base/java.net.InetAddress$CachedAddresses.get(InetAddress.java:797)--&amp;gt;	Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: &lt;/LI-CODE&gt;&lt;P&gt;I need to extract 2 fields&amp;nbsp; -&lt;/P&gt;&lt;P&gt;1) method (e.g. - POST)&lt;/P&gt;&lt;P&gt;2) path (between 1st pair of quotes) - e.g,&amp;nbsp;&lt;STRONG&gt;&lt;FONT color="#339966"&gt;/sports/v1/boxing&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;and 2)exception_type (anything between 1st quote closing and before first occurrence of --&amp;gt;)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;java.net.UnknownHostException: alert-rest-service.backend&lt;/FONT&gt;&lt;/STRONG&gt;-&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Splunk query i am trying is below&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="k8s*" messageType=ERROR "*Exception:*--&amp;gt;" 
| rex "500 Server Error for HTTP (?&amp;lt;http_method&amp;gt;\\S+).*\\\\\"(?&amp;lt;resource_url&amp;gt;.*)\\\\\"(?&amp;lt;java_exception&amp;gt;.*?(Exception)).*"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Query works fine to extract "http_method" and "resource_url"&lt;/P&gt;&lt;P&gt;but "java_exception" is not being extracted properly. Can someone help?&lt;/P&gt;</description>
    <pubDate>Wed, 18 Nov 2020 03:14:40 GMT</pubDate>
    <dc:creator>donB</dc:creator>
    <dc:date>2020-11-18T03:14:40Z</dc:date>
    <item>
      <title>extract exception from stacktrace field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/extract-exception-from-stacktrace-field/m-p/529851#M149677</link>
      <description>&lt;P&gt;Below is a sample log message.&amp;nbsp; Each message will have string "500 Server Error for HTTP" and i need to extract 3 fields after the occurrence of "500 Server Error for HTTP" string&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;2020-11-18T00:32:37.632Z LCS userId=null LCE [helper-http-epoll-1] ERROR o.s.b.a.w.r.e.AbstractErrorWebExceptionHandler.error(122) - 500 Server Error for HTTP POST "/sports/v1/boxing"java.net.UnknownHostException: my-rest-service.backend--&amp;gt;	at java.base/java.net.InetAddress$CachedAddresses.get(InetAddress.java:797)--&amp;gt;	Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: &lt;/LI-CODE&gt;&lt;P&gt;I need to extract 2 fields&amp;nbsp; -&lt;/P&gt;&lt;P&gt;1) method (e.g. - POST)&lt;/P&gt;&lt;P&gt;2) path (between 1st pair of quotes) - e.g,&amp;nbsp;&lt;STRONG&gt;&lt;FONT color="#339966"&gt;/sports/v1/boxing&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;and 2)exception_type (anything between 1st quote closing and before first occurrence of --&amp;gt;)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;java.net.UnknownHostException: alert-rest-service.backend&lt;/FONT&gt;&lt;/STRONG&gt;-&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Splunk query i am trying is below&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="k8s*" messageType=ERROR "*Exception:*--&amp;gt;" 
| rex "500 Server Error for HTTP (?&amp;lt;http_method&amp;gt;\\S+).*\\\\\"(?&amp;lt;resource_url&amp;gt;.*)\\\\\"(?&amp;lt;java_exception&amp;gt;.*?(Exception)).*"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Query works fine to extract "http_method" and "resource_url"&lt;/P&gt;&lt;P&gt;but "java_exception" is not being extracted properly. Can someone help?&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2020 03:14:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/extract-exception-from-stacktrace-field/m-p/529851#M149677</guid>
      <dc:creator>donB</dc:creator>
      <dc:date>2020-11-18T03:14:40Z</dc:date>
    </item>
    <item>
      <title>Re: extract exception from stacktrace field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/extract-exception-from-stacktrace-field/m-p/529871#M149686</link>
      <description>&lt;LI-CODE lang="markup"&gt;index="k8s*" messageType=ERROR "*Exception:*--&amp;gt;" 
| rex "500 Server Error for HTTP (?&amp;lt;http_method&amp;gt;\S+).*\\\"(?&amp;lt;resource_url&amp;gt;.*)\\\"(?&amp;lt;java_exception&amp;gt;.*?Exception)"&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 18 Nov 2020 09:12:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/extract-exception-from-stacktrace-field/m-p/529871#M149686</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-11-18T09:12:02Z</dc:date>
    </item>
  </channel>
</rss>

