logstash 电子邮件插件安装给出错误

logstash email plugin install giving error

如果字符串匹配,我正在尝试从 logstash 发送电子邮件警报,但是当我要在 logstash 1.4 上安装 logstash-output-email 插件时出现错误

sudo bin/plugin install logstash-output-email
Can only install contrib at this time... Exiting.

我不知道我是否需要安装该插件或它已经安装

已编辑 升级到 2.0 Logstash 后,我的配置如下所示

output {

elasticsearch { hosts => ["localhost:9200"] }
    if  "ERROR" in [message]  {
    email  {
        options => [ "smtpIporHost", "smtp.gmail.com",
         "port", "587",
         "userName", "test@gmail.com",
         "password", "password",
         "authenticationType", "plain",
         "starttls","true"
           ]
            from => "test@gmail.com"
            subject => "logstash alert"
            to => "test@gmail.com"
            via => "smtp"
            body => "Here is the event line that occured: %{message}"
       }
    }

    stdout { codec => rubydebug }
 }

任何想法并在 logstash 日志中得到错误

:message=>"Unknown setting 'options' for email", :level=>:error}
{:timestamp=>"2015-11-02T12:59:24.598000+0000", :message=>"Error: Something is wrong with your configuration."}

I am getting error now after upgrade to 2.0 logstash

是的,因为 options => 已弃用并且在 logstash v2.0 中不再可用。请参阅v2.0 email plugin docs。这就是为什么它说 :message=>"Unknown setting 'options' for email.

您需要将 options => 部分内的所有值迁移到新设置中。这样的事情可能会奏效:

email  {
     port           =>    "587"
     address        =>    "smtp.gmail.com"
     username       =>    "test@gmail.com"
     password       =>    "password"
     authentication =>    "plain"
     use_tls        =>    true
     from           =>    "test@gmail.com"
     subject        =>    "logstash alert"
     to             =>    "test@gmail.com"
     via            =>    "smtp"
     body           =>    "Here is the event line that occured: %{message}"
}

查看两者,old v1.5 email docs and the new v2.0 email docs 了解有关迁移的更多信息。