2015-03-10 4 views
0

Я пытаюсь настроить logstash для отправки почты, когда кто-то заходит на мой сервер. Но, похоже, это не сработает. Это мой конфигурационный файл в /etc/logstash/conf.d/email.confУведомление электронной почты Logstash

Мой файл:

input { 
file { 
type => "syslog" 
path => "/var/log/auth.log" 
    } 
} 

filter { 
if [type] == "syslog" { 
grok { 
pattern => [ "%{SYSLOGBASE} Failed password for %{USERNAME:user} from % {IPORHOST:host} port %{POSINT:port} %{WORD:protocol}" ] 
add_tag => [ "auth_failure" ] 
    } 
         } 
    } 

output { 
email { 
tags => [ "auth_failure" ] 
to => "<[email protected]>" 
from => "<[email protected]>" 
options => [ "smtpIporHost", "smtp.abc.com", 
      "port", "25", 
      "domail", "abc.com", 
      "userName", "[email protected]", 
      "password", "mypassword", 
      "authenticationType", "plain", 
      "debug", "true" 
      ] 
subject => "Error" 
via => "smtp" 
body => "Here is the event line %{@message}" 
htmlbody => "<h2>%{matchName}</h2><br/><br/><h3>Full Event</h3><br/><br/><div align='center'>%{@message}</div>" 
} 
     } 
  • Мой logstash файл /var/log/logstash/logstash.log

{:timestamp=>"2015-03-10T11:46:41.152000+0700", :message=>"Using milestone 1 output plugin 'email'. This plugin should work, but would benefit from use by folks like you. Please let us know if you find bugs or have suggestions on how to improve this plugin. For more information on plugin milestones, see http://logstash.net/docs/1.4.1/plugin-milestones", :level=>:warn}

любого тела, пожалуйста, помогите!

ответ

0

Вы не используете правильный синтаксис в своем grok filter. Он должен выглядеть следующим образом:

grok { 
    match => ["message", "..."] 
} 

Другие незначительные комментарии:

  • Использование tags => ["auth_failure"] для условной фильтрации является устаревшим. Предпочитает if "auth_failture" in [tags].
  • В теле письма вы ссылаетесь на сообщение с @message. Это тоже устарело, и поле называется простым message.
Смежные вопросы