日志样例
2024-09-02 10:47:03 433 [o.a.d.q.s.h.HttpProcessHandler]-[ERROR] 106 [] [DUBBO] can not find commandContext: org.apache.dubbo.qos.command.CommandContext@4c017a53, dubbo version: 2.7.23, current host: 192.168.1.123
org.apache.dubbo.qos.command.NoSuchCommandException: NoSuchCommandException:beans.json
at org.apache.dubbo.qos.command.DefaultCommandExecutor.execute(DefaultCommandExecutor.java:35)
at org.apache.dubbo.qos.server.handler.HttpProcessHandler.channelRead0(HttpProcessHandler.java:66)
at org.apache.dubbo.qos.server.handler.HttpProcessHandler.channelRead0(HttpProcessHandler.java:49)
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352)
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352)
at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:438)
fluentd 配置
<source>
type tail
path /data/log/tomcat8080/logs/catalina.%Y-%m-%d.log
pos_file /data/var/fluentd/pos/tomcat8080.pos
tag tomcat.portal
format multiline
multiline_flush_interval 5s
format_firstline /^\d{4}-\d{1,2}-\d{1,2} \d{1,2}:\d{1,2}:\d{1,2} [0-9]{3})/
format1 /^(?<time>\d{4}-\d{1,2}-\d{1,2} \d{1,2}:\d{1,2}:\d{1,2} [0-9]{3}) \[(?<event>[^\s]+)\]-\[(?<level>[^\s]+)\] (?<line>\d+) \[(?<traceid>[^\]]*)\]\s+(?<message>.*)/
</source>
可以用以下正则来匹配,
^(?<time>\d{4}-\d{1,2}-\d{1,2} \d{1,2}:\d{1,2}:\d{1,2} [0-9]{3}) \[(?<event>[^\s]+)\]-\[(?<level>[^\s]+)\] (?<line>\d+) \[(?<traceid>[^\]]*)\]\s+(?<message>.*)
启用多行模式,行首匹配规则
^(?<time>\d{4}-\d{1,2}-\d{1,2} \d{1,2}:\d{1,2}:\d{1,2} [0-9]{3})
附:
参考 log4j 官方配置 Conversion Word
参考 fluentd 官方配置 docs.fluentd.org
张贴您的评论