coroot 与一般基于ebpf 进行系统监控的工具不一样,coroot 将log 也放到了prometheus 中
玩法参考图
对于metrics 以及log 都是通过prometheus exporter push 到中央的prometheus 中,同时coroot 的server 做为一个prometheus 的client 直接查询metrics 数据
为了提升性能以及处理coroot 包含了cache
agent 集成
当前coroot 已经提供了几个自己开发的exporter (就是上图的agent)node-agent 是基于了ebpf 开发的(kernel 需要4.16)提供了不少功能,比如log,还有
对于主机以及应用层网络的处理,pg agent 是coroot 对于现有pg exporer 的扩展,解决了不少现有监控工具的问题
node agent 日志处理
上边也提到了对于日志的处理,node-agent 提起之后会按照日常的级别,做为一个metrics 暴露,数据为label 为Sample,之后对于dashboard 的widge 显示会使用到
参加node-agent 的metrics
coroot server 简单的处理
具体处理代码 constructor/queries.go
以及constructor/containers.go
以上存储是container_log_messages_total 但是在coroot server 中处理的是container_log_messages
对于日志解析部分,coroot 使用了logpattern 自己开发的解析包,会在agent 以及server 中集成使用
说明
coroot 对于日志也是存放在prometheus 中,prometheus 对于label 的值大小是可以限制的(默认不限制),尽管这个不是一个很好的实现,但是目前coroot 的agent
对于日志并不是都存储,而且存储的是分级之后的,并不是很多,也是一个不错的选择,至少从架构上比较简单,对于大量查询的问题,coroot 基于cache 解决此问题
参考资料
https://github.com/coroot/coroot-node-agent
https://github.com/coroot/coroot
https://github.com/prometheus/prometheus/issues/8291
https://prometheus.io/docs/prometheus/latest/configuration/configuration/