Extract specific line from java stack trace

hi everyone,

what i need to do is to extract from a java stack trace a specific line using the elk stack.
What i have, as example, is the exception below and in kibana I want to have only the line starting with com.host.financial.plat.system.end.processor******* . At the moment, with the multiline options I'm able to take the whole exception stack trace but only one line is what i need (if it's possible).

*        at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:299)*
*        at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:223)*
*        at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:540)*
*        at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:746)*
*        at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:714)*
*        at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:532)*
*        at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:304)*
*        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)*
*        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)*
*        at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)*
*        at **com.host.financial.plat.system.end.processor.AnalyticsProcessor$$EnhancerBySpringCGLIB$$d660f5cd.process(<generated>)***
*        ... 26 common frames omitted*````````

thank you in advance
Gerardo

You might be able to do it by combining all the lines of the trace with a multiline codec (I think the documentation has an example involving a Java stack trace), then use mutate+split to turn that into an array of lines, then use mutate+add_field to extract the last but one entry.

thx man, this worked great.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.