Requesting help with search query. I have application logs in Splunk like,
And I'm using following query to separate different sections of the message,
What I see is,
What I expect is,
mydatetime | logger | thread | logmsg |
2024-04-02T12:26:02.244-04:00 | org.apache.catalina.core.NamingContextListener | main | Creating JNDI naming context |
2024-04-02T12:26:02.118-04:00 | org.apache.catalina.core.NamingContextListener | main | Adding resource ref UserDatabase ResourceRef[className=org.apache.catalina.UserDatabase,factoryClassLocation=null,factoryClassName=org.apache.naming.factory.ResourceFactory,{type=description,content=User database that can be updated and saved},{type=scope,content=Shareable},{type=auth,content=Container},{type=singleton,content=true},{type=factory,content=org.apache.catalina.users.MemoryUserDatabaseFactory},{type=pathname,content=conf/tomcat-users.xml}] |
You don't need the = after the rex
| rex "(?<mydatetime>^\S*)\,severity=(?<severity>\S*)\,thread=(?<thread>\S*)\,logger=(?<logger>\S*)\,\{\}\,(?<logmsg>.*)"
Updated to remove brackets in the logmsg pattern
Yes indeed it does solve the issue, but now there's a new issue
Streamed search execute failed because: Error in 'rex' command: regex="(?<mydatetime>^\S*)\,severity=(?<severity>\S*)\,thread=(?<thread>\S*)\,logger=(?<logger>\S*)\,\{\}\,(?<logmsg>(.)*)" has exceeded the configured depth_limit, consider raising the value in limits.conf..
This regex works with the sample events and is much more efficient according to regex101.com.
| rex "(?<mydatetime>[^,]+),severity=(?<severity>[^,]+),thread=(?<thread>[^,]+),logger=(?<logger>[^,]+),\{\},(?<logmsg>.*)"
And this rex doesn't produce any error
Again, what's with the = after the regex? Is this just a typo?
I re-checked by putting the rex you've provided once again without the equal(=) symbol, but surprisingly the error message comes back with words 'regex='
You don't need the = after the rex
| rex "(?<mydatetime>^\S*)\,severity=(?<severity>\S*)\,thread=(?<thread>\S*)\,logger=(?<logger>\S*)\,\{\}\,(?<logmsg>.*)"
Updated to remove brackets in the logmsg pattern