环境:
ELK 6.6.2版本、Ubuntu 16.04.6 LTS
1、安装插件:
/usr/local/logstash/bin/logstash-plugin install logstash-output-exec
2、nginx access日志搜集检测403状态码邮件告警配置文件示例:
|
input { file { type => "nginx-access" path => "/usr/local/nginx/logs/access.log" } } filter { grok { match => { "message" => "%{COMBINEDAPACHELOG}" } } date { match => [ "timestamp" , "dd/MMM/yyyy:HH:mm:ss Z" ] } }
output { elasticsearch { hosts => "192.168.254.131:9200" } stdout { codec => rubydebug } if [response] == "403" { exec { command => "echo '%{host}:%{type}' | mail -s '403_error' xxxxxxxx@qq.com" } } } |
|
|
启动logstash,配置nginx 访问403页面测试告警:
本文介绍如何使用Logstash 6.6.2版本在Ubuntu 16.04.6 LTS上配置Nginx access日志监测,并针对403状态码通过邮件发送告警通知。配置包括安装所需插件、定义输入源、过滤器及输出规则。
527

被折叠的 条评论
为什么被折叠?



