查看日志上下文

老师,您好,向您请教问题: 目前我们公司处理日志用的是elk,但是开发提了一个需求,他们要查看程序产生的日志,并且能够看到日志的上下文,请老师给点建议,学习
已邀请:

赵班长 - 不忘初心,方得始终!

赞同来自: liuhhhhh 夜画星空

可以使用multiline插件把多个事件做合并。例如:
input {
file {
type => "system-messages"
path => "/var/log/messages"
}

file {
type => "elasticsearch-error"
path => "/usr/local/elasticsearch/logs/elk.log"
codec => multiline {
pattern => "^\["
negate => true
what => "previous"
}
}
}

output {
if [type] == "system-messages" {
elasticsearch {
host => "192.168.56.11"
protocol => "http"
index => "system-messages-%{+YYYY-MM}"
}
}

if [type] == "elasticsearch-error" {
elasticsearch {
host => "192.168.56.11"
protocol => "http"
index => "elasticsearch-error-%{+YYYY-MM}"
}
}
}

liuhhhhh - 90后

明白了 多谢老师 

dayatu - 每天都需要积累一点

看了您的架构师课程,感觉您理解的真深,向老师致敬
明白了
 
 
 
特地注册账号,给赵老师赞一个

要回复问题请先登录注册