Re: [PATCH v2] Add systemd journal support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/28/2012 07:08 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
> 
> Add support for logging to the systemd journal, using its
> simple client library. The benefit over syslog is that it
> accepts structured log data, so the journald can store
> individual items like code file/line/func separately from
> the string message. Tools which require structured log
> data can then query the journal to extract exactly what
> they desire without resorting to string parsing
> 
> While systemd provides a simple client library for logging,
> it is more convenient for libvirt to directly write its
> own client code. This lets us build up the iovec's on
> the stack, avoiding the need to alloc memory when writing
> log messages.
> 

> +
> +    if (strchr(rawstr, '\n')) {
> +        uint64_t nstr;
> +        /* If 'str' containes a newline, then we must
> +         * encode the string length, since we can't
> +         * rely on the newline for the field separator
> +         */
> +        IOVEC_SET_STRING(iov[niov++], "MESSAGE\n");
> +        nstr = htole64(strlen(rawstr));


> +    if ((buffd = mkostemp(path, O_CLOEXEC|O_RDWR)) < 0)
> +        return;

It turns out that RHEL 5 glibc is too old to have either htole64 or
mkostemp.  Gnulib has mkostemp, and I could add htole64 to gnulib easily
enough.  But when you realize that this will only ever work on systems
with systemd, and that RHEL 5 lacks systemd, the easier fix is to just
disable compilation of systemd logging on RHEL 5.  Patch coming up.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]