我在logstash conf文件中遇到问题。早些时候它工作,但现在我已经在电子邮件警报块中添加了一个条件,现在它已经崩溃了。
这是工作部分:
output {
elasticsearch { host => ["HOST1","HOST2" ] port => "9200" protocol => "http" }
if [severity] in ['Erro', 'ERROR'] {
email {
from => "testemail@testdomain.com"
subject => "Attention | Email alert"
to => "testemail@testdomain.com"
via => "smtp"
htmlbody => "<h2>Below log line has been reported</h2><br/><br/><div
align='left'>%{message}</div>"
options => [
"smtpIporHost", "smtp.office365.com",
"port", "587",
"domain", "smtp.office365.com",
"userName", "testemail@testdomain.com",
"password", "testpwd",
"authenticationType", "login",
"starttls", "true"
]
}
}
stdout { codec => rubydebug }
}
现在只需添加额外的'或'条件:
output {
elasticsearch { host => ["HOST1","HOST2" ] port => "9200" protocol => "http" }
if [severity] in ['Erro', 'ERROR'] or [event] in "MssTooBusy" {
email {
from => "testemail@testdomain.com"
subject => "Attention | Email alert"
to => "testemail@testdomain.com"
via => "smtp"
htmlbody => "<h2>Below log line has been reported</h2><br/><br/><div
align='left'>%{message}</div>"
options => [
"smtpIporHost", "smtp.office365.com",
"port", "587",
"domain", "smtp.office365.com",
"userName", "testemail@testdomain.com",
"password", "testpwd",
"authenticationType", "login",
"starttls", "true"
]
}
}
stdout { codec => rubydebug }
}
我收到以下错误:
TypeError: can't convert nil into String
include? at org/jruby/RubyString.java:4464
output_func at (eval):1449
outputworker at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.4-java/lib/logstash/pipeline.rb:244
start_outputs at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.4-java/lib/logstash/pipeline.rb:166
非常感谢任何指示,
谢谢!