Search code examples
emaillogstashlogstash-configuration

logstash email plugin install giving error


I am trying to send email alert from logstash if a string match but I got error when I am going to install logstash-output-email plugin on logstash 1.4

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

I have no idea do I need to install that plugin or its already install

Edited After upgrade to 2.0 Logstash my configuration look like this

output {

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

    stdout { codec => rubydebug }
 }

any idea and get error in logstash logs

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

Solution

  • I am getting error now after upgrade to 2.0 logstash

    Yes, because options => is deprecated and no longer available in logstash v2.0. Please see the v2.0 email plugin docs. That's why it says :message=>"Unknown setting 'options' for email.

    You need to migrate all values inside the options => part into new settings. Something like this might work:

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

    Take a look at both, the old v1.5 email docs and the new v2.0 email docs for more information about migration.