我在服务器中部署了带有计算机代理的analytics-agent,并配置了模式以查看应用程序日志。我可以在Controller UI中看到日志。我只想将level = ERROR日志发送到控制器。如何实现?
作业文件
version: 2
enabled: true
source:
type: file
path: /data/nifi/logs
nameGlob: nifi-app.log
startAtEnd: true
fields:
sourceType: nifi
grok:
patterns:
- '%{TIMESTAMP_ISO8601:timestamp} %{LOGLEVEL:level} \[%{DATA:thread}\] %{DATA:class} %{GREEDYDATA:message}'
eventTimestamp:
pattern: "yyyy-MM-dd HH:mm:ss,SSS"
日志样本
2019-05-20 17:59:31,409 ERROR [Timer-Driven Process Thread-22] o.a.nifi.processors.standard.ListSFTP ListSFTP[id=282914ca-f485-32ff-8ba9-93236a9de836] Failed to perform listing on remote host due to java.io.IOException: Failed to obtain connection to remote host due to com.jcraft.jsch.JSchException: Auth fail: {}
答案 0 :(得分:0)
如果您不希望将级别作为字段,请尝试这种仅与ERROR行匹配的grok模式。
%{TIMESTAMP_ISO8601:timestamp}错误[%{DATA:thread}]%{DATA:class} %{GREEDYDATA:message}