Yes, you are correct. Thanks a lot for your guidance. Through debugging, we successfully reproduced this problem. Now the problem is narrowed down, but something is still unclear.
Through debug mode, we discovered that for multiline logs, this seems to be an inevitable issue. It appears that the multiline stage is causing the regex stage to be ignored (I’m not sure if that’s the case). From the screenshot of the debugging process below, it can be seen that the second line of the log does not seem to be matched and processed by the regex stage. However, when we tested the regular expression on the website regex101: build, test, and debug regex, it worked fine (see the screenshot below).
Therefore, we hope that you can guide us once again in fix the configuration. Thank you for your help!
debug screenshot
debug log
Here, the replace stage configured in promtail.yaml above is deleted to make debugging more concise.
[inspect: regex stage]:
{stages.Entry}.Extracted["level"]:
+: WARN
{stages.Entry}.Extracted["message"]:
+: WARN [customActivityService,83f4b54eb219483d,030723f5ca1261a4] 9 --- [http-nio-8080-exec-2] o.c.s.i.ActivityPublicServiceServiceImpl : [sadsadsadsadsdsdsadsadsa]sdsads,dsds[dsdsasa21312321]
{stages.Entry}.Extracted["spanid"]:
+: 030723f5ca1261a4
{stages.Entry}.Extracted["time"]:
+: 2023-07-16 18:15:33.202
{stages.Entry}.Extracted["traceid"]:
+: 83f4b54eb219483d
[inspect: timestamp stage]:
{stages.Entry}.Entry.Entry.Timestamp:
-: 2023-07-19 12:15:12.407455051 +0800 CST
+: 2023-07-16 18:15:33.202 +0800 CST
[inspect: output stage]:
{stages.Entry}.Entry.Entry.Line:
-: 2023-07-16 18:15:33.202 WARN [customActivityService,83f4b54eb219483d,030723f5ca1261a4] 9 --- [http-nio-8080-exec-2] o.c.s.i.ActivityPublicServiceServiceImpl : [sadsadsadsadsdsdsadsadsa]sdsads,dsds[dsdsasa21312321]
+: WARN [customActivityService,83f4b54eb219483d,030723f5ca1261a4] 9 --- [http-nio-8080-exec-2] o.c.s.i.ActivityPublicServiceServiceImpl : [sadsadsadsadsdsdsadsadsa]sdsads,dsds[dsdsasa21312321]
[inspect: labeldrop stage]: none
2023-07-16T18:15:33.202+0800 {__path__="/tmp/logs/catalina.out"} WARN [customActivityService,83f4b54eb219483d,030723f5ca1261a4] 9 --- [http-nio-8080-exec-2] o.c.s.i.ActivityPublicServiceServiceImpl : [sadsadsadsadsdsdsadsadsa]sdsads,dsds[dsdsasa21312321]
[inspect: regex stage]: none
[inspect: regex stage]:
{stages.Entry}.Extracted["level"]:
+: INFO
{stages.Entry}.Extracted["message"]:
+: INFO [customActivityService,471338c0bf32b4e8,89db8d229388c79c] 9 --- [http-nio-8080-exec-7] sdk.biz.info : Summary^_^10000^_^null^_^ProtocalMustParams:=&charset=UTF-8&=&method=app.messagetemplate.subscribe.query×tamp=2023-07-16 18:42:13^_^&format=json^_^ApplicationParams:biz_content={"template_id_list":["","",""],"user_id":""}^_^2ms,22ms,1ms^_^trace_id:21909bb516895041334394597ea618
{stages.Entry}.Extracted["spanid"]:
+: 89db8d229388c79c
{stages.Entry}.Extracted["time"]:
+: 2023-07-16 18:42:13.511
{stages.Entry}.Extracted["traceid"]:
+: 471338c0bf32b4e8
[inspect: timestamp stage]:
{stages.Entry}.Entry.Entry.Timestamp:
-: 2023-07-19 12:15:12.407457515 +0800 CST
+: 2023-07-16 18:15:33.202000001 +0800 CST
[inspect: timestamp stage]:
{stages.Entry}.Entry.Entry.Timestamp:
-: 2023-07-19 12:15:12.408975882 +0800 CST
+: 2023-07-16 18:42:13.511 +0800 CST
[inspect: output stage]: none
[inspect: output stage]:
{stages.Entry}.Entry.Entry.Line:
-: 2023-07-16 18:42:13.511 INFO [customActivityService,471338c0bf32b4e8,89db8d229388c79c] 9 --- [http-nio-8080-exec-7] sdk.biz.info : Summary^_^10000^_^null^_^ProtocalMustParams:=&charset=UTF-8&=&method=app.messagetemplate.subscribe.query×tamp=2023-07-16 18:42:13^_^&format=json^_^ApplicationParams:biz_content={"template_id_list":["","",""],"user_id":""}^_^2ms,22ms,1ms^_^trace_id:21909bb516895041334394597ea618
+: INFO [customActivityService,471338c0bf32b4e8,89db8d229388c79c] 9 --- [http-nio-8080-exec-7] sdk.biz.info : Summary^_^10000^_^null^_^ProtocalMustParams:=&charset=UTF-8&=&method=app.messagetemplate.subscribe.query×tamp=2023-07-16 18:42:13^_^&format=json^_^ApplicationParams:biz_content={"template_id_list":["","",""],"user_id":""}^_^2ms,22ms,1ms^_^trace_id:21909bb516895041334394597ea618
[inspect: labeldrop stage]: none
2023-07-16T18:15:33.202000001+0800 {__path__="/tmp/logs/catalina.out"} 2023-07-16 18:39:09.136 ERROR [customActivityService,891efb1888700110,0ebfe9a6361e5711] 9 --- [http-nio-8080-exec-9] c.o.ms.handler.GlobalExceptionHandler :
java.lang.NullPointerException: null
at cn.oola.custom.service.impl.FreeActivityServiceImpl.isTodayRegist(FreeActivityServiceImpl.java:436)
at cn.oola.custom.service.impl.FreeActivityServiceImpl.isEnoughParticipate(FreeActivityServiceImpl.java:442)
at cn.oola.custom.service.impl.FreeActivityServiceImpl.userJoinActivityInfo(FreeActivityServiceImpl.java:422)
at cn.oola.custom.service.impl.FreeActivityServiceImpl$$FastClassBySpringCGLIB$$cb5b36ec.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:783)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:698)
at cn.oola.custom.service.impl.FreeActivityServiceImpl$$EnhancerBySpringCGLIB$$6550589b.userJoinActivityInfo(<generated>)
at cn.oola.custom.controller.wx.WebFreeActivityController.userJoinActivityInfo(WebFreeActivityController.java:73)
at jdk.internal.reflect.GeneratedMethodAccessor489.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)[inspect: labeldrop stage]: none
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1067)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:655)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.cloud.sleuth.instrument.web.servlet.TracingFilter.doFilter(TracingFilter.java:68)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.cloud.sleuth.instrument.web.servlet.TracingFilter.doFilter(TracingFilter.java:89)
at org.springframework.cloud.sleuth.autoconfig.instrument.web.LazyTracingFilter.doFilter(TraceWebServletConfiguration.java:121)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:97)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:540)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:769)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:382)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:895)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1722)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:829)
2023-07-16T18:42:13.511+0800 {__path__="/tmp/logs/catalina.out"} INFO [customActivityService,471338c0bf32b4e8,89db8d229388c79c] 9 --- [http-nio-8080-exec-7] sdk.biz.info : Summary^_^10000^_^null^_^ProtocalMustParams:=&charset=UTF-8&=&method=app.messagetemplate.subscribe.query×tamp=2023-07-16 18:42:13^_^&format=json^_^ApplicationParams:biz_content={"template_id_list":["","",""],"user_id":""}^_^2ms,22ms,1ms^_^trace_id:21909bb516895041334394597ea618
sample log
2023-07-16 18:15:33.202 WARN [customActivityService,83f4b54eb219483d,030723f5ca1261a4] 9 --- [http-nio-8080-exec-2] o.c.s.i.ActivityPublicServiceServiceImpl : [sadsadsadsadsdsdsadsadsa]sdsads,dsds[dsdsasa21312321]
2023-07-16 18:39:09.136 ERROR [customActivityService,891efb1888700110,0ebfe9a6361e5711] 9 --- [http-nio-8080-exec-9] c.o.ms.handler.GlobalExceptionHandler :
java.lang.NullPointerException: null
at cn.oola.custom.service.impl.FreeActivityServiceImpl.isTodayRegist(FreeActivityServiceImpl.java:436)
at cn.oola.custom.service.impl.FreeActivityServiceImpl.isEnoughParticipate(FreeActivityServiceImpl.java:442)
at cn.oola.custom.service.impl.FreeActivityServiceImpl.userJoinActivityInfo(FreeActivityServiceImpl.java:422)
at cn.oola.custom.service.impl.FreeActivityServiceImpl$$FastClassBySpringCGLIB$$cb5b36ec.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:783)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:698)
at cn.oola.custom.service.impl.FreeActivityServiceImpl$$EnhancerBySpringCGLIB$$6550589b.userJoinActivityInfo(<generated>)
at cn.oola.custom.controller.wx.WebFreeActivityController.userJoinActivityInfo(WebFreeActivityController.java:73)
at jdk.internal.reflect.GeneratedMethodAccessor489.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1067)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:655)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.cloud.sleuth.instrument.web.servlet.TracingFilter.doFilter(TracingFilter.java:68)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.cloud.sleuth.instrument.web.servlet.TracingFilter.doFilter(TracingFilter.java:89)
at org.springframework.cloud.sleuth.autoconfig.instrument.web.LazyTracingFilter.doFilter(TraceWebServletConfiguration.java:121)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:97)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:540)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:769)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:382)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:895)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1722)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:829)
2023-07-16 18:42:13.511 INFO [customActivityService,471338c0bf32b4e8,89db8d229388c79c] 9 --- [http-nio-8080-exec-7] sdk.biz.info : Summary^_^10000^_^null^_^ProtocalMustParams:=&charset=UTF-8&=&method=app.messagetemplate.subscribe.query×tamp=2023-07-16 18:42:13^_^&format=json^_^ApplicationParams:biz_content={"template_id_list":["","",""],"user_id":""}^_^2ms,22ms,1ms^_^trace_id:21909bb516895041334394597ea618