12Factor应用程序:使用Fluentd捕获stdout/stderr日志 [英] 12Factor App: Capturing stdout/stderr logs with Fluentd

查看:255
本文介绍了12Factor应用程序:使用Fluentd捕获stdout/stderr日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过阅读 12factor 中的以下帖子,我想出了一个问题,我想检查一下你们是如何处理的. /p>

基本上,应用程序应直接写入stdout/stderr.无论如何,是否可以将这些流直接重定向到流利的(不绑定到rsyslog/syslog)?随着我对流利程度的逐渐意识到,我相信它将是从多个应用程序/平台进行日志聚合的好工具.

这样做的主要原因是,如果该应用程序是跨平台的,则rsyslog/syslog可能不可用,并且据我所知,使用日志记录框架(需要它们进行必要的配置才能正常工作)会违反12因子.

谢谢!

解决方案

您需要配置流程管理器以使用fluentd.

十二因子应用程序进程应依赖操作系统的进程管理器(例如Upstart,分布式云平台上的流程管理器或开发中的Foreman之类的工具来管理输出流[...]."

基本上,该想法是日志重定向是流程管理器所关心的问题.例如,暴发户通常依赖于配置fluentd以将同一套接字用作输入流.

Fluentd支持很多输入流(它们称为数据源),这应该提供解决方案适用于几乎所有环境您可能正在使用的流程管理器(为了提供更完整的解决方案,我们需要知道).

By reading the following post from 12factor I have come up with a question I'd like to check how you guys handle this.

Basically, an app should write directly to stdout/stderr. Is there anyway to redirect these streams directly to fluentd (not bound to rsyslog/syslog)? As I become more aware of fluentd, I believe it would be a great tool for log aggregation from multiple apps/platforms.

The main reasoning for this is, if the app is cross-platform, rsyslog/syslog may not be available, and as I understand, using logging frameworks (which need the required configuration for them to work) would be a violation of the 12factor.

Thanks!

解决方案

You need to configure your process manager to use fluentd.

"Twelve-factor app processes should [...] rely on the operating system’s process manager (such as Upstart, a distributed process manager on a cloud platform, or a tool like Foreman in development) to manage output streams [...]."

Basically, the idea is that log redirection is a concern of the process manager. Upstart, for example, usually relies on logger, which has an option (-u) to write to a Unix Domain Socket. In turn, you can configure fluentd to use that same socket as an input stream.

Fluentd supports a lot of input streams (they call them data sources), which should provide a solution for just about any environment & process manager you might be using (which we need to know in order to provide a more complete solution).

这篇关于12Factor应用程序:使用Fluentd捕获stdout/stderr日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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