
On Wed, Oct 17, 2012 at 08:17:18PM +0200, Miloslav Trmač wrote:
This is independent from the rest of the series, sending it anyway for consideration; this makes the metadata available to users on non-systemd platforms. I believe the technical objections (primarily async-signal-safety) have been resolved; the question of whether the project wants to support this or not is still open, of course.
Add a "syslog/json" output format, which uses a JSON representation (as specified in Lumberjack project, and planned for the CEE standard) to format individual components, making the result easy to parse without writing custom code or using unreliable regexps.
Example message (line-wrapped for readability, the actual output is a single line):
Oct 17 16:29:56 kulicka libvirt: @cee: {"msg":"Domain not found", "LIBVIRT_SOURCE":"error","priority":"err", "CODE_FILE":"../../src/test/test_driver.c","CODE_LINE":1405, "CODE_FUNC":"testLookupDomainByName", "timestamp":"2012-10-17 14:29:56.683+0000","DOMAIN":12,"CODE":42, "STR1":"Domain not found","STR2":""}
None of the existing log output formats (e.g. "syslog" or "file") is affected.
Async-signal-safety is preserved by a) providing a custom allocation function to yajl, and b) using a custom print function. Both use memory allocated within the stack frame.
I appreciate that you were able to re-work this to be async safe. Personally though I would prefer not to have this in libvirt, because I feel that syslog json support is really bad approach to the problem and I don't want to validate it in the eyes of others as a good solution by including it in libvirt. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|