---
name: "xo_close_log"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/xo_close_log"
---

# xo\_close\_log(3)

create SYSLOG (RFC5424) log records using libxo formatting

## 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

The **xo\_syslog**() function creates log entries following the standard defined in RFC5424. These messages are sent to the log [syslogd(8)](/syslogd/8.md) daemon, where they can be filtered, forwarded, and archived. **libxo** format strings are used to create both the message text and the **SD-PARAMS** content, containing name/value pairs that can be parsed by suitable automation software.

Refer to [xo\_format(5)](/xo_format/5.md) for basic information about formatting strings. **xo\_syslog** encodes all value fields at SD-PARAMS within the syslog message. An exception is made for fields with the "{d:}" modifier; such fields appear in the message text only, with fields with the "{e:}" modifier appear as SD-PARAMS, but not in the message text.

**xo\_vsyslog**() accepts a *va\_list* for additional flexibility.

**xo\_open\_log**(), **xo\_close\_log**(*,*, *and*) **xo\_set\_logmask**() are all analogous to their libs counterparts, [openlog(3)](/openlog/3.md), [closelog(3)](/closelog/3.md), and [setlogmask(3)](/setlogmask/3.md). The extra underscores in the names are unfortunate, but keep consistency in **libxo** function names.

## EXAMPLES

```
    xo_syslog(LOG_LOCAL4 | LOG_NOTICE, "ID47",
              "{e:iut/%u}An {:event-source} {:event-id/%u} log entry",
              iut, source, id);
```

## SEE ALSO

[xo\_syslog(3)](/xo_syslog/3.md), [xo\_set\_syslog\_enterprise\_id(3)](/xo_set_syslog_enterprise_id/3.md), [xo\_format(5)](/xo_format/5.md), [libxo(3)](/libxo/3.md)

## HISTORY

The **libxo** library first appeared in FreeBSD 11.0.

## AUTHORS

**libxo** was written by Phil Shafer ⟨*phil@freebsd.org*⟩.
