Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interface for structured logging #22

Open
mattaezell opened this issue Apr 16, 2015 · 0 comments
Open

Interface for structured logging #22

mattaezell opened this issue Apr 16, 2015 · 0 comments

Comments

@mattaezell
Copy link

The README.md file lists the following motivation for this library:

  • provide an interface for structured logging - but only if there is a real demand for it (to be seen based on feedback)

I think this would be very valuable. Machines with systemd can use native journal API calls to add structured data to the system journal. Some packages are adding support for this, but it has to be a compile-time option for the package to remain portable to non-systemd (or even non-Linux) machines. I see a need for a universal system call for "log this with structured data" that can work with the journal or syslog daemons.

The hard question is: how should the structured message be formatted? For journal output, it's easy. Just call the native API and let journald figure it out. When writing to /dev/log, we have to use an easy-to-parse structure. We can use RFC-5424, raw JSON, @Cee JSON (umberlog?), or some new format. Do we really want a JSON serializer in liblogging? Or require packages to pull in an external JSON serializer? Anyway, I'm not a big fan of taking a tree of key-value pairs, serializing them to a JSON string, having the syslog daemon deserialize it back into variables (possibly modifying or adding fields), and then syslog serializes it for output (to a file or over the network).

journald still uses a UNIX socket, right? Maybe we could borrow it's over-the-socket format? I wonder if that's a public/stable protocol?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant