logstash结合zabbix报警安装部署

cd /usr/share/logstash/
vim Gemfile
source "https://ruby.taobao.org/" ##修改成国内镜像站
source "https://gems.ruby-china.org/" ##修改成国内镜像站
 
bin/logstash-plugin install logstash-output-zabbix ##安装logstash-output-zabbix
 
 
 
/usr/bin/zabbix_sender -z 172.25.11.98 -p 10051 -s 172.25.11.77 -k zabbix_key -o "hello world"
 
zabbix_server -R config_cache_reload
 
zabbix_proxy -R config_cache_reload
 
vim test.conf
 
input {
file {
path => "/root/nginx.log"
start_position => "beginning"
type => "nginx.log"
}
}
 
 
filter {
grok {
match => [ "message", "(error|ERROR|CRITICAL)" ]
add_tag => [ "zabbix-sender" ]
add_field => [
"zabbix_host", "200.3.199.213",
"zabbix_key", "zabbix_key"
]
}
}
 
output {
if "zabbix-sender" in [tags] {
zabbix{
zabbix_host => "zabbix_host"
zabbix_key => "zabbix_key"
zabbix_server_host => "200.3.199.153"
zabbix_server_port => "10051"
zabbix_value => "message"
}
}
}
 
Logstash整合zabbix 过滤Nginx 错误日志并进行报警zabbix配置 http://www.mamicode.com/info-detail-1809812.html
 
原文地址:https://www.cnblogs.com/zhaishaomin/p/7417293.html