# Logstash 1.5.0 email output plugin issue-connection failed

**URL:** <https://discuss.elastic.co/t/logstash-1-5-0-email-output-plugin-issue-connection-failed/94742>\
**Category:** Logstash\
**Created:** [July 27, 2017, 5:26am UTC](https://discuss.elastic.co/t/logstash-1-5-0-email-output-plugin-issue-connection-failed/94742 "2017-07-27T05:26:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![abc1](https://avatars.discourse-cdn.com/v4/letter/a/e47774/32.png) [@abc1](https://discuss.elastic.co/u/abc1)\
**Post date:** [July 27, 2017, 5:26am UTC](https://discuss.elastic.co/t/logstash-1-5-0-email-output-plugin-issue-connection-failed/94742/1 "2017-07-27T05:26:15Z")

</div>

I want to send mail when particular log occurs again and again so I am trying to send email using logstash 1.5.0 when a line matches with he given grok pattern but due to connection failure i am not getting email. (I am using elasticsearch 1.6.0 and kibana 4.1.0).

```
 config file:
input {
  file {
    path => "D:/logsf/b1.log"		
   
	 start_position => "beginning"	
 	 sincedb_path => "D:/ELK/LogAnalysis/loginput1.sincedb"
	
	 
  }
}
filter
{

grok {
                match => {"message" => "(.*)" }
                add_tag => ["_ERR_GENERIC"]
                }
date {
    match => ["timestamp", "MM/dd/yy HH:mm:ss:ms"]
  }
}
output {  
        if "_ERR_GENERIC" in [tags] {
                email {
          options => [ "smtpIporHost", "localhost",
         "port", "25",
          	
         
         "authenticationType", "plain",
         "starttls","true"
           ]

			from => "test@gmail.com"
            subject => "logstash alert"
            to => "abc@gmail.com"
            via => "smtp"
            body => "Here is the event line that occured: %{message}"
                }
        }

elasticsearch { 
			action => "index"
			host => "localhost" 
		    
		    index => "abcdemo"
       		    workers => 1
} stdout { codec => rubydebug 
                }}

```

when i am running logstash -f command for the first time i am getting this error in logstash command prompt window:

```
Logstash startup completed
OpenSSL::SSL::SSLError: An existing connection was forcibly closed by the remote host
        connect at org/jruby/ext/openssl/SSLSocket.java:180
     tlsconnect at C:/ELK/logstash-1.5.0/logstash-1.5.0/vendor/jruby/lib/ruby/1.9/net/smtp.rb:584
       do_start at C:/ELK/logstash-1.5.0/logstash-1.5.0/vendor/jruby/lib/ruby/1.9/net/smtp.rb:561
          start at C:/ELK/logstash-1.5.0/logstash-1.5.0/vendor/jruby/lib/ruby/1.9/net/smtp.rb:520
       deliver! at C:/ELK/logstash-1.5.0/logstash-1.5.0/vendor/bundle/jruby/1.9/gems/mail-2.6.3/lib/mail/network/delivery_methods/smtp.rb:112
       deliver! at C:/ELK/logstash-1.5.0/logstash-1.5.0/vendor/bundle/jruby/1.9/gems/mail-2.6.3/lib/mail/message.rb:252
        receive at C:/ELK/logstash-1.5.0/logstash-1.5.0/vendor/bundle/jruby/1.9/gems/logstash-output-email-0.1.8/lib/logstash/outputs/email.rb:250
         handle at C:/ELK/logstash-1.5.0/logstash-1.5.0/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.0-java/lib/logstash/outputs/base.rb:88
    output_func at (eval):83
   outputworker at C:/ELK/logstash-1.5.0/logstash-1.5.0/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.0-java/lib/logstash/pipeline.rb:244
  start_outputs at C:/ELK/logstash-1.5.0/logstash-1.5.0/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.0-java/lib/logstash/pipeline.rb:166

for the second time i am getting this error:

Logstash startup completed
Errno::ECONNREFUSED: Connection refused - Connection refused
     initialize at org/jruby/ext/socket/RubyTCPSocket.java:126
           open at org/jruby/RubyIO.java:1177
     tcp_socket at D:/ELK/logstash-1.5.0/logstash-1.5.0/vendor/jruby/lib/ruby/1.
9/net/smtp.rb:541
       do_start at D:/ELK/logstash-1.5.0/logstash-1.5.0/vendor/jruby/lib/ruby/1.
9/net/smtp.rb:550
        timeout at org/jruby/ext/timeout/Timeout.java:126
       do_start at D:/ELK/logstash-1.5.0/logstash-1.5.0/vendor/jruby/lib/ruby/1.
9/net/smtp.rb:550
          start at D:/ELK/logstash-1.5.0/logstash-1.5.0/vendor/jruby/lib/ruby/1.
9/net/smtp.rb:520
       deliver! at D:/ELK/logstash-1.5.0/logstash-1.5.0/vendor/bundle/jruby/1.9/
gems/mail-2.6.3/lib/mail/network/delivery_methods/smtp.rb:112
       deliver! at D:/ELK/logstash-1.5.0/logstash-1.5.0/vendor/bundle/jruby/1.9/
gems/mail-2.6.3/lib/mail/message.rb:252
        receive at D:/ELK/logstash-1.5.0/logstash-1.5.0/vendor/bundle/jruby/1.9/
gems/logstash-output-email-0.1.8/lib/logstash/outputs/email.rb:250
         handle at D:/ELK/logstash-1.5.0/logstash-1.5.0/vendor/bundle/jruby/1.9/
gems/logstash-core-1.5.0-java/lib/logstash/outputs/base.rb:89
    output_func at (eval):82
   outputworker at D:/ELK/logstash-1.5.0/logstash-1.5.0/vendor/bundle/jruby/1.9/
gems/logstash-core-1.5.0-java/lib/logstash/pipeline.rb:244
  start_outputs at D:/ELK/logstash-1.5.0/logstash-1.5.0/vendor/bundle/jruby/1.9/
gems/logstash-core-1.5.0-java/lib/logstash/pipeline.rb:166
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 24, 2017, 5:26am UTC](https://discuss.elastic.co/t/logstash-1-5-0-email-output-plugin-issue-connection-failed/94742/2 "2017-08-24T05:26:44Z")

</div>

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