简体   繁体   English

使用fluentd,elsasticsearch和kibana获取在kubernetes容器中运行的tomcat容器的日志

[英]Getting logs of tomcat containers running in kubernetes pods using fluentd, elsasticsearch and kibana

We are using Kubernetes and we have multiple tomcat/jws containers running on multiple pods. 我们正在使用Kubernetes,并且在多个Pod上运行了多个tomcat / jws容器。 What would be best approach for centralized logging using fluentd, Elasticsearch and Kibana. 什么是使用fluentd,Elasticsearch和Kibana进行集中日志记录的最佳方法 The main purpose is to get the tomcat logs which are running in pods (example: access.log and catalina.log), also the application log which is deployed on the tomcat. 主要目的是获取在pod中运行的tomcat日志 (例如:access.log和catalina.log),以及部署在tomcat上的应用程序日志。 Also we need to differentiate the logs coming from different pods (tomcat container). 我们还需要区分来自不同容器(tomcat容器) 的日志 I followed below link https://access.redhat.com/documentation/en/red-hat-enterprise-linux-atomic-host/7/getting-started-with-containers/chapter-11-using-the-atomic-rsyslog-container-image From this I am only able to get container logs but not able to get tomcat log. 我按照下面的链接https://access.redhat.com/documentation/en/red-hat-enterprise-linux-atomic-host/7/getting-started-with-containers/chapter-11-using-the-atomic- rsyslog-container-image从这里我只能获取容器日志,而不能获取tomcat日志。

-Praveen -普拉文

have a look at this example: 看一下这个例子:

https://github.com/kubernetes/contrib/tree/master/logging/fluentd-sidecar-es https://github.com/kubernetes/contrib/tree/master/logging/fluentd-sidecar-es

The basic idea is to deploy an additional fluentd container in your pod and share a volume between the containers. 基本思想是在您的容器中部署另一个流利的容器,并在容器之间共享一定的体积。 The application container writes the logs into the volume and the fluentd container mounts the same volume readonly and feeds the logs to elasticsearch. 应用程序容器将日志写入卷中,而流利的容器以只读方式安装相同的卷,并将日志馈送给elasticsearch。 In the default configuration the log events get a tag like "file.application.log". 在默认配置中,日志事件将获得一个标签,例如“ file.application.log”。

We evaluate this setup at the moment but we have more application containers with the same logfile name. 目前,我们评估此设置,但是我们有更多具有相同日志文件名称的应用程序容器。 So there is still work todo. 因此,仍有工作要做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM