I have all types of Java Exceptions within my logs, that have no real form to them, except that they all start with "com." or "java." and end with exactly ".Exception".
java.lang.IllegalStateException java.lang.NullPointerException javax.servlet.ServletException com.ibm.blah.SomeException etc.
How can I extract this in-line?
If you want it purely inline, try:
| rex field=_raw "\b(?<exception_type>(com|java|javax)\.[\w\.]+Exception)"
(Match on either "com" or "java" or javax, followed by a dot, and then as many word characters or dots as you need until you finish with "Exception")
If you'd rather not have to use it in the search string, then:
[exception-type] REGEX = \b((com|java|javax)\.[\w\.]+Exception)\b FORMAT = exception_type::$1
[yoursourcetype] REPORT-exceptions = exception-type
Or, you can configure an eventtype for each exception type or group of exception types.
How do I then reference these fields? I tried the following, but it did not work.
eventtype="allweb" *Exception | rex field=raw ".(?
Thanks for the help!
I think you have a simple typo. Taking part of your query:
You're right that it was a typo, but the question mark was in the right place. The leading dot should have been a word breaker ('.' vs '\b'). Edited above to correct.