简体   繁体   English

在 kubernetes 中存储来自应用程序的日志

[英]Store logs from applications in kubernetes

What is the recommended approach to store the logs of applications deployed on Kubernetes?存储部署在 Kubernetes 上的应用程序日志的推荐方法是什么? I read about ELK stack, but not sure about the pros and cons.我读过 ELK 堆栈,但不确定利弊。 Needs recommendations.需要推荐。

If you ask specifically about storing application logs in kubernetes cluster , there are a few different approaches.如果您专门询问在kubernetes cluster 中存储应用程序日志,有几种不同的方法。 First I would recommend you to familiarize with this article in the official kubernetes documentation .首先,我建议您熟悉kubernetes官方文档中的这篇文章

As per my experience with the Kubernetes logging, I would suggest you go with EFK stack (Fluentd/flunetbit --> Kafka --> Logstash/flunetd --> Elasticserach --> kibana), this one has initial challenges during setup but once this is up and running, it will be like a super scalable system where you don't need to worry about volume of logs you are shipping.根据我在 Kubernetes 日志记录方面的经验,我建议您使用 EFK 堆栈(Fluentd/flunetbit --> Kafka --> Logstash/flunetd --> Elasticserach --> kibana),这个在设置过程中遇到了最初的挑战,但一次这已启动并正在运行,它将像一个超级可扩展的系统,您无需担心要发送的日志量。

Another approach you can take is shipping logs directly from fluentd/fluentbit/filebeat to Elasticsearch.您可以采用的另一种方法是将日志直接从 fluentd/fluentbit/filebeat 传送到 Elasticsearch。 The drawback of this approach is if ES has some issue then you may lose your logs.这种方法的缺点是如果 ES 有问题,那么您可能会丢失日志。

I hope it helps.我希望它有帮助。

I want to emphasize the response from @javajon.我想强调@javajon 的回应。 There is a KataCoda exercise specifically for logging at https://katacoda.com/javajon/courses/kubernetes-observability/efk .https://katacoda.com/javajon/courses/kubernetes-observability/efk 上有专门用于日志记录的 KataCoda 练习。

Logging is a very large topic with lots of variables.日志是一个非常大的主题,有很多变量。 In order to get any specific advice, you'll need to comment about your goals for logging.为了获得任何具体建议,您需要评论您的日志记录目标。 Is it related to performance, compliance, security, debugging, observability or something else?它与性能、合规性、安全性、调试、可观察性或其他方面有关吗?

Try to get some knowledge by yourself.尝试自己获得一些知识。 Every storage have some pros and cons according to requirement we use them.根据我们使用它们的要求,每个存储都有一些优点和缺点。 Visit https://medium.com/volterra-io/kubernetes-storage-performance-comparison-9e993cb27271 and learn more.访问https://medium.com/volterra-io/kubernetes-storage-performance-comparison-9e993cb27271并了解更多信息。 I will surely somehow help.我肯定会以某种方式提供帮助。

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

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