LIBXO(3)
π LIBXO(3) β the syslog glow-up bestie edition
okay so this is from the Library Functions Manual and it's literally all about making SYSLOG (RFC5424) log records with libxo formatting. yes queen, structured logging, we love to see it β¨
π NAME π
xo_syslog, xo_vsyslog, xo_open_log, xo_close_log, xo_set_logmask β create SYSLOG (RFC5424) log records using libxo formatting π
π LIBRARY π
library βlibxoβ
β¨ SYNOPSIS β¨
#include <libxo/xo.h>
void
xo_syslog(int pri, const char *name, const char *fmt, ...);
void
xo_vsyslog(int pri, const char *name, const char *fmt, va_list vap);
void
xo_close_log(void);
void
xo_open_log(const char *ident, int logstat, int logfac);
int
xo_set_logmask(int pmask);
π¦ DESCRIPTION π¦
okay so xo_syslog() creates log entries following the standard defined in RFC5424. these messages get sent to the log syslogd(8) daemon, where they can be filtered, forwarded, and archived. and here's the iconic part: libxo format strings are used to create both the message text and the SD-PARAMS content, which contains name/value pairs that can be parsed by suitable automation software. like, your logs are literally machine-readable bestie, we're obsessed π
go read xo_format(5) for the basic tea on formatting strings. xo_syslog encodes all value fields at SD-PARAMS within the syslog message. but there's an exception, because of course there is:
- fields with the
"{d:}"modifier appear in the message text only - fields with the
"{e:}"modifier appear as SD-PARAMS, but not in the message text
xo_vsyslog() accepts a va_list for additional flexibility. fancy π
xo_open_log(), xo_close_log(), and xo_set_logmask() are all analogous to their libs counterparts, openlog(3), closelog(3), and setlogmask(3). the extra underscores in the names are unfortunate, but they keep consistency in libxo function names. we forgive them π«Ά
πΈ EXAMPLES πΈ
xo_syslog(LOG_LOCAL4 | LOG_NOTICE, "ID47",
"{e:iut/%u}An {:event-source} {:event-id/%u} log entry",
iut, source, id);
look at that. gorgeous. no notes π₯
π SEE ALSO π
xo_syslog(3), xo_set_syslog_enterprise_id(3), xo_format(5), libxo(3)
β HISTORY β
the libxo library first appeared in FreeBSD 11.0.
π AUTHORS π
libxo was written by Phil Shafer <phil@freebsd.org>. thank you king π
and that's the whole page bestie!! π this beauty comes to you from Debian, dated July 20, 2015, and it's the LIBXO(3) page β go forth and log responsibly, mwah πβ¨
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 2015, Juniper Networks, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms