偏头痛杨 2019-06-27
其他版本请参阅版本化的插件文档。
有关插件的问题,请在讨论论坛中打开一个主题,对于bug或特性请求,在Github中打开一个issue,关于Elastic支持的插件列表,请考虑Elastic支持矩阵。
当收到输出时发送email,或者,你可以使用条件包含或排除email输出执行。
output {
if "shouldmail" in [tags] {
email {
to => '[email protected]'
from => '[email protected]'
subject => 'Alert - %{title}'
body => "Tags: %{tags}\\n\\Content:\\n%{message}"
template_file => "/tmp/email_template.mustache"
domain => 'mail.example.com'
port => 25
}
}
}此插件支持以下配置选项以及稍后描述的通用选项。
| 设置 | 输入类型 | 要求 |
|---|---|---|
address | string | No |
attachments | array | No |
authentication | string | No |
body | string | No |
cc | string | No |
bcc | string | No |
contenttype | string | No |
debug | boolean | No |
domain | string | No |
from | string | No |
htmlbody | string | No |
password | string | No |
port | number | No |
replyto | string | No |
subject | string | No |
to | string | Yes |
use_tls | boolean | No |
username | string | No |
via | string | No |
template_file | path | No |
还可以查看所有输出插件支持的通用选项列表。
address
“localhost”attachments
[]authentication
body
""cc
该字段还接受以逗号分隔的地址字符串,例如:“[email protected], [email protected]”
bcc
contenttype
"text/html; charset=UTF-8"debug
falsedomain
“localhost”from
“[email protected]”htmlbody
""password
port
25replyto
subject
""to
“[email protected], [email protected]”,你还可以使用%{fieldname}语法从事件中获取的动态字段use_tls
falseusername
via
"smtp"template_file
body一起发送多部分的电子邮件,优先于htmlbody所有输出插件都支持以下配置选项:
| 设置 | 输入类型 | 要求 |
|---|---|---|
codec | codec | No |
enable_metric | boolean | No |
id | string | No |
codec
"plain"enable_metric
trueid
在插件配置中添加唯一的id,如果没有指定ID,则Logstash将生成一个,强烈建议在配置中设置此ID,当你有两个或多个相同类型的插件时,这一点特别有用。例如,如果你有两个电子邮件输出,在本例中添加一个命名ID将有助于在使用监控API时监控Logstash。
output {
email {
id => "my_plugin_id"
}
}