ERROR logstash.outputs.email

Hi,
My code:

email {
    to => "za@gmail.com"
    via => 'smtp'
	address => 'smtp.gmail.com'
	from => 'john@gmail.com'
    authentication => "plain"
    username => "john@gmail.com"
	password => "john123"
	subject => 'Alert '
	body => "Test message test...."
	port => 587
	use_tls => true
    }

and i got this error:

Something happen while delivering an email {:exception=>#<Net::SMTPAuthenticationError: 535-5.7.8 Username and Password not accepted.

what Username and Password should i use i dont understand!

Any help would be sincerely appreciate!
Thanks.

The email output needs to connect to a SMTP server to send the e-mails, since you didn't configure the domain option in the output, it is connecting to localhost.

Since you want to send the e-mail as your gmail user, you need to use the Gmail smtp server, which I think is smtp.gmail.com in the domain option, but If I'm not wrong you will need to change somethings in your gmail account to allow that, I think you will need to crea an app password.

This is not a Logstash issue, you need to check in Gmail/Google documentation how to send e-mails using their SMTP.

1 Like

Thanks Leandro, it works
another question please my filter bloc:

filter {
    if !("Exception" in [message] or "EXCEPTION" in [message]) {drop{}}
}

it gives me this output in mail:

I just want to ask you if i can regroupe all this mails in one mail contains all of them or somthing like this cuz imagine that i have more than 40 exception for example it will send me a 40 emails ?!

Thanks!

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