12Factor App: Capturing stdout/stderr logs with Fluentd
Asked Answered
M

2

15

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!

Messidor answered 25/2, 2015 at 21:57 Comment(1)
with docker everything becomes easierShanan
L
4

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).

Lennon answered 29/7, 2015 at 22:52 Comment(0)
C
3

This is still an experimental program, but you can take a look at stdout-hook.

This program reads STDOUT output from child process, and post the records to Fluentd.

Creep answered 26/2, 2015 at 22:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.