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