# Emailing through logstash not working

**URL:** <https://discuss.elastic.co/t/emailing-through-logstash-not-working/223690>\
**Category:** Logstash\
**Created:** [March 16, 2020, 5:38am UTC](https://discuss.elastic.co/t/emailing-through-logstash-not-working/223690 "2020-03-16T05:38:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sagar\_Mandal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sagar_mandal/32/57073_2.png) [@Sagar\_Mandal](https://discuss.elastic.co/u/Sagar_Mandal)\
**Post date:** [March 16, 2020, 5:38am UTC](https://discuss.elastic.co/t/emailing-through-logstash-not-working/223690/1 "2020-03-16T05:38:26Z")

</div>

Hi Team,

I wrote this small logstash config. in which i just want to pick up some data and when the data comes it gets filter, and in the output section when the data comes it send an email.

```
    input{
 file {
   type => "dummylog"
   path => ["/root/sample.log"]
}
}
filter {
  grok {
    match => {
      "message" => '%{IPORHOST:remote_ip} - %{DATA:user_name} \[%{HTTPDATE:time}\] "%{WORD:request_action} %{DATA:request} HTTP/%{NUMBER:http_version}" %{NUMBER:response} %{NUMBER:bytes} "%{DATA:referrer}" "%{DATA:agent}"'
    }
  }
  date {
    match => ["time", "dd/MMM/YYYY:HH:mm:ss Z"]
    locale => en
  }
geoip {
    source => "remote_ip"
    target => "geoip"
  }
useragent {
    source => "agent"
    target => "user_agent"
  }
}
output{
email {
to => " ******* @gmail.com"
address => "smtp.gmail.com"
port => "465"
via => "smtp"
username => ""
password => ""
from =>""
subject => "Email Testing from logstash"
body =>"This is Working now"
}
}

```

Here I'm confused in the output section, like i'f i'm giving from =\> [xxxx@gmail.com](mailto:xxxx@gmail.com), so where do i give that [xxxx@gmail.com](mailto:xxxx@gmail.com)'s credentials and also where do i give the mail server credentials, if there is any particular mail server.

really need help in this guys.

Thanks and Regards,  
Sagar Mandal

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [March 16, 2020, 5:57pm UTC](https://discuss.elastic.co/t/emailing-through-logstash-not-working/223690/2 "2020-03-16T17:57:49Z")

</div>

The username and password options are used to authenticate with the server at address:port.

---

<div class="post-metadata">

**Author:** ![Sagar\_Mandal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sagar_mandal/32/57073_2.png) [@Sagar\_Mandal](https://discuss.elastic.co/u/Sagar_Mandal)\
**Post date:** [March 17, 2020, 4:51am UTC](https://discuss.elastic.co/t/emailing-through-logstash-not-working/223690/3 "2020-03-17T04:51:23Z")

</div>

so in this cases the username and password are the email's right?

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [March 17, 2020, 12:41pm UTC](https://discuss.elastic.co/t/emailing-through-logstash-not-working/223690/4 "2020-03-17T12:41:26Z")

</div>

That is correct.

---

<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:** [April 14, 2020, 12:41pm UTC](https://discuss.elastic.co/t/emailing-through-logstash-not-working/223690/5 "2020-04-14T12:41:32Z")

</div>

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