在Openshift中解析容器的标准输出 [英] Parse stdout of containers in Openshift

查看:117
本文介绍了在Openshift中解析容器的标准输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于Openshift/Kubernetes,我有点菜鸟,所以希望我能对我的用例做足够的解释.

I'm a bit of a noob when it comes to Openshift/Kubernetes, so I hope that I can explain my use case well enough.

我有一个小的程序"的Docker映像,可以概括如下:它在日志文件的末尾添加-f,并且当发现与config中指定的正则表达式匹配的内容时,它会向某人发送电子邮件.诸如监视应用程序的生产日志,以及在应用程序日志中打印出一封带有堆栈跟踪的电子邮件之类的信息到Ops团队.

I have a Docker image of a small "program", it can be summarised as the following: it tails -f a log file, and when something that matches a regex specified in config is found, it sends an email to someone. Something like monitoring a production log of an application and sending an email with a stacktrace to the Ops team if one is printed in the application log.

当我的应用程序日志是通过在主机上运行的Weblogic应用程序上的Java EE生成的,或者由另一个Docker容器生成但已保存到绑定安装的文件系统的日志生成的,因此可以通过(如果安装) 监视"容器.

This works fine when my application log is produced via let's say a Java EE on Weblogic app running on the host, or a log produced by another docker container but saved to a bind mounted filesystem, therefore accessible (if mounted) by the "monitoring" container.

现在,我需要部署此映像以监视在Openshift中运行的2-3个微服务.这些微服务记录到stdout,并且我没有特权将root拥有的路径(例如/var/lib/docker/containers/[container-id]/[container-id]-json.log)安装到监视"容器中

Now I need to deploy this image to monitor 2-3 microservices running in Openshift. These microservices log to stdout, and I do not have privileges to mount a path owned by root like /var/lib/docker/containers/[container-id]/[container-id]-json.log to the "monitoring" container.

解析微服务日志的最佳方法是什么?我可以更改他们的logback配置,以使其登录到stdout并例如到emptyDir卷,并使用microservice + volume + monitoring容器创建Pod.

What is the best way to be able to parse the microservices logs? I am allowed to change their logback config to have them log to stdout AND to an emptyDir volume for example, and create a Pod with the microservice+volume+monitoring container.

谢谢大家的建议, 罗伯托

Thank you everyone for your suggestions, Roberto

推荐答案

对于Docker来说,它是流利的日志合成工具.但是,您不能仅使用Openshift的ansible安装程序进行流利的安装(请参见 fluentd-logging-driver ). 那里关于Docker主机配置的入门". 然后,您可以使用任何输出插件来存储日志

There's fluentd for Docker as log agreggator. However, you cannot install only fluentd with openshift's ansible installer (see deploying-efk). You can install fluentd logging driver on docker host manually (see fluentd-logging-driver). There's 'getting started' about docker host configuration. Then you can use any output plugin to store logs

这篇关于在Openshift中解析容器的标准输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆