我想通过EFK做一个日志管理系统。我正在尝试几天来让我的多行 mycat 日志解析器与 fluent-bit 一起使用。
我的流利的配置:
parsers.conf:
[PARSER]
Name mycat_error_log_parser_head
Format regex
Regex ^(?<time>(\d)+(-\d+)+(\S)+\W(\S)+)(\s+)(?<action>\S+)(\s+)(?<on>\S+)
Time_Key time
Time_Format %Y-%m-%d %H:%M:%S.%L
Time_Keep On
[PARSER]
Name mycat_error_log_parser
Format regex
Regex ^(?<time>(\d)+(-\d+)+(\S)+\W(\S)+)(\s+)(?<action>\S+)(\s+)(?<on>\S+)(\s+)(?<content>(.|\s)*)$
Time_Key time
Time_Format %Y-%m-%d %H:%M:%S.%L
Time_Keep On
fluent-bit.conf
[INPUT]
Name tail
tag mycat
path /var/log/mycat.log
Multiline On
Parser_Firstline mycat_error_log_parser_head
Parser mycat_error_log_parser
Path_Key file
mycat.log 看起来像这样:
mycat.log
2018-08-02 09:59:41.205 INFO [$_NIOConnector] (io.mycat.backend.datasource.PhysicalDatasource.getConnection(PhysicalDatasource.java:529)) - no ilde connection in pool,create new connection for hostS1 of schema mysql
2018-08-02 09:59:53.939 INFO [Timer0] (io.mycat.backend.datasource.PhysicalDatasource.getConnection(PhysicalDatasource.java:529)) - no ilde connection in pool,create new connection for hostS1 of schema mysql
2018-08-02 10:00:01.173 ERROR [$_NIOConnector] (io.mycat.net.NIOConnector.finishConnect(NIOConnector.java:155)) - error:
java.net.ConnectException: Connection timed out
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) ~[?:1.7.0_111]
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:744) ~[?:1.7.0_111]
at io.mycat.net.NIOConnector.finishConnect(NIOConnector.java:165) ~[Mycat-server-1.6.5-release.jar:?]
at io.mycat.net.NIOConnector.finishConnect(NIOConnector.java:143) ~[Mycat-server-1.6.5-release.jar:?]
at io.mycat.net.NIOConnector.run(NIOConnector.java:98) ~[Mycat-server-1.6.5-release.jar:?]
2018-08-02 10:00:01.173 INFO [$_NIOConnector] (io.mycat.net.AbstractConnection.close(AbstractConnection.java:514)) - close connection,reason:java.net.ConnectException: Connection timed out ,MySQLConnection [id=0, lastTime=1533175073937, user=root, schema=mysql, old shema=mysql, borrowed=false, fromSlaveDB=true, threadId=0, charset=utf8, txIsolation=3, autocommit=true, attachment=null, respHandler=null, host=parse1, port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]
2018-08-02 10:00:01.173 INFO [$_NIOConnector] (io.mycat.sqlengine.SQLJob.connectionError(SQLJob.java:117)) - can't get connection for sql :select user()
我想我现在很接近,但到目前为止还没有运气。
在我的 kibana 中。我得到以下结果: 在此处输入图像描述
我的多行错误日志丢失。但我在 rubular 中测试它正常解析 在此处输入图像描述
任何帮助,将不胜感激。