[solved] Logstash if condition sometimes not work!

Here is my logstash's config:
input {
beats {
port => 8888
}
}
output {
if [message] =~ "[ERROR]" {
exec {
command => "echo -e %{fields} 上出现以下日志报警: '\n\n' %{message} '\n\n' 请登录 http://172.17.96.165:5601 查看日志 | mail -s 生产环境日志报警 xxx@xxx.com"
}
}
elasticsearch {
hosts => "172.17.96.165:9200"
index => "karpfi-log-nodejs"
}
}

I found some logs the if condition was not match,such as:
2019-01-18 03:24:05.702 [ERROR] [console] [cess/warning.js:18] (node:14) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.

And some logs the if condition was match,such as:
06:29:57.733 [INFO] [ERROR] [api/services/utils.js:66] {data:{},error:null,success:true}

Sorry,It's my fault.The problem is the commad.

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