标签:logstash
logstash.conf的配置文件
一、监控日志文件,匹配关键字,输出到指定文件/发送邮件。
input {
file {
path => ["你的日志文件"]
}
}
filter {
if ([message] !~ "你的匹配关键字") {
drop {}
}
if [loglevel] == "debug" {
drop {
percentage => 40
}
}
}
output {
stdout{
codec => rubydebug
}
if ([message] =~ "你的匹配关键字") {
file {
path => "输出到指定文件"
}
email {
to => "接收邮箱"
from => "发送者"
address => "smtp.sina.cn"
domain => "sina.cn"
username => "你的用户名"
password => "你的密码"
subject => "error log"
body => "%{path}"
htmlbody => "%{message}"
}
}
}
本文出自 “浅谈技术” 博客,谢绝转载!
标签:logstash
原文地址:http://netpeak.blog.51cto.com/1135737/1892814