LIBXO(3)
π LIBXO(3) π
okay bestie, sit down, we're talking about libxo β the library that makes your Unix programs spit out structured data like it's nothing. this page is all about the xo_syslog family, the ones that build SYSLOG (RFC5424) log records using libxo formatting. no cap, it's giving observability. π¦
β¨ 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 π«
so xo_syslog() is the main character here. it creates log entries following the standard defined in RFC5424. these messages get sent to the syslogd(8) daemon, where they can be filtered, forwarded, and archived β the whole glow-up pipeline. β¨ and here's the slay part: libxo format strings are used to create both the message text and the SD-PARAMS content, which is full of name/value pairs that suitable automation software can parse. it's giving machine-readable. π₯
if you wanna know the basics of formatting strings, go read xo_format(5). xo_syslog encodes all value fields at SD-PARAMS within the syslog message. but there's an exception, bestie, listen up: fields with the "{d:}" modifier appear in the message text only, and fields with the "{e:}" modifier appear as SD-PARAMS, but not in the message text. iconic little switcheroo. π
xo_vsyslog() is the same vibe but accepts a va_list for extra flexibility. π«Ά
now 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, ngl, but they keep consistency in libxo function names. we respect the bit. π
π EXAMPLES π
xo_syslog(LOG_LOCAL4 | LOG_NOTICE, "ID47",
"{e:iut/%u}An {:event-source} {:event-id/%u} log entry",
iut, source, id);
π SEE ALSO π
π¦ HISTORY π¦
the libxo library first appeared in FreeBSD 11.0. π
π AUTHORS π
libxo was written by Phil Shafer <phil@freebsd.org>. π
π ADDITIONAL DOCUMENTATION π
FreeBSD uses libxo version 1.7.5. complete documentation can be found on github:
https://juniper.github.io/libxo/1.7.5/html/index.html
libxo lives on github as:
https://github.com/Juniper/libxo
the latest release of libxo is available at:
https://github.com/Juniper/libxo/releases
πΈ HISTORY πΈ
the libxo library was added in FreeBSD 11.0. (yes bestie, it's listed twice, and we're keeping both, periodt. π )
β AUTHOR β
Phil Shafer
and that's the whole page, bestie!! this one came from the Debian build of the manual, dated July 20, 2015, for LIBXO(3). go forth and log responsibly. π«Άπβ¨
π¦ where this page comes from
- epel 9: libxo-devel 1.7.5-1.el9 Β· LicenseRef-Callaway-BSD
- fedora 43: libxo-devel 1.7.5-2.fc43 Β· LicenseRef-Callaway-BSD
- fedora 43: libxo-devel 1.7.5-2.fc43 Β· LicenseRef-Callaway-BSD
- fedora 44: libxo-devel 1.7.5-3.fc44 Β· LicenseRef-Callaway-BSD
- fedora 44: libxo-devel 1.7.5-3.fc44 Β· LicenseRef-Callaway-BSD
- nixpkgs unstable: libxo 1.7.5
- Copyright (c) 2015, Juniper Networks, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms