LIBXO(3)

πŸ“¦
version 1.7.5 Β· 2 versions
, in epel 9, fedora 43, fedora 44, nixpkgs unstable

πŸ’– 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