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

时间:2015-10-28 15:55:19

标签: email logstash logstash-configuration

如果字符串匹配,我正尝试从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."}

1 个答案:

答案 0 :(得分:4)

  

升级到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 docsnew v2.0 email docs两者。