在config/kibana.yml
添加
i18n.locale: "zh-CN"
对应服务器安装logstash
,配置规则,例如新建logstash-apache.conf
input {
file {
path => "/home/ruoyi/logs/sys-*.log"
start_position => beginning
sincedb_path => "/dev/null"
codec => multiline {
pattern => "^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}"
negate => true
auto_flush_interval => 3
what => previous
}
}
}
filter {
if [path] =~ "info" {
mutate { replace => { type => "sys-info" } }
grok {
match => { "message" => "%{COMBINEDAPACHELOG}" }
}
date {
match => [ "timestamp" , "dd/MMM/yyyy:HH:mm:ss Z" ]
}
} else if [path] =~ "error" {
mutate { replace => { type => "sys-error" } }
} else {
mutate { replace => { type => "random_logs" } }
}
}
output {
elasticsearch {
hosts => '120.78.129.95:9200'
}
stdout { codec => rubydebug }
}
启动logstash
./logstash -f logstash-apache.conf
通过kibana
可视化检索各个服务日志数据 kibana
powered by kaifamiao