xref: /freebsd/contrib/libxo/libxo/xo_syslog.3 (revision a0ee8cc6)
1.\" #
2.\" # Copyright (c) 2015, Juniper Networks, Inc.
3.\" # All rights reserved.
4.\" # This SOFTWARE is licensed under the LICENSE provided in the
5.\" # ../Copyright file. By downloading, installing, copying, or
6.\" # using the SOFTWARE, you agree to be bound by the terms of that
7.\" # LICENSE.
8.\" # Phil Shafer, July 2015
9.\"
10.Dd July 20, 2015
11.Dt LIBXO 3
12.Os
13.Sh NAME
14.Nm xo_syslog , xo_vsyslog , xo_open_log , xo_close_log , xo_set_logmask
15.Nd create SYSLOG (RFC5424) log records using libxo formatting
16.Sh LIBRARY
17.Lb libxo
18.Sh SYNOPSIS
19.In libxo/xo.h
20.Ft void
21.Fn xo_syslog "int pri" "const char *name" "const char *fmt" "..."
22.Ft void
23.Fn xo_vsyslog "int pri" "const char *name" "const char *fmt" "va_list vap"
24.Ft void
25.Fn xo_close_log "void"
26.Ft void
27.Fn xo_open_log "const char *ident" "int logstat" "int logfac"
28.Ft int
29.Fn xo_set_logmask "int pmask"
30.Sh DESCRIPTION
31The
32.Fn xo_syslog
33function creates log entries following the standard defined in
34RFC5424.
35These messages are sent to the log
36.Xr syslogd 8
37daemon, where they can be filtered, forwarded, and archived.
38.Nm libxo
39format strings are used to create both the message text and the
40.Nm SD-PARAMS
41content, containing name/value pairs that can be parsed by suitable
42automation software.
43.Pp
44Refer to
45.Xr xo_format 5
46for basic information about formatting strings.
47.Nm xo_syslog
48encodes all value fields at SD-PARAMS within the syslog message.
49An exception is made for fields with the "{d:}" modifier; such fields
50appear in the message text only, with fields with the "{e:}" modifier
51appear as SD-PARAMS, but not in the message text.
52.Pp
53.Fn xo_vsyslog
54accepts a
55.Fa va_list
56for additional flexibility.
57.Pp
58.Fn xo_open_log ,
59.Fn xo_close_log , and
60.Fn xo_set_logmask
61are all analogous to their libs counterparts,
62.Xr openlog 3 ,
63.Xr closelog 3 , and
64.Xr setlogmask 3 .
65The extra underscores in the names are unfortunate, but keep
66consistency in
67.Nm libxo
68function names.
69.Sh EXAMPLES
70.Bd -literal -offset indent
71    xo_syslog(LOG_LOCAL4 | LOG_NOTICE, "ID47",
72              "{e:iut/%u}An {:event-source} {:event-id/%u} log entry",
73              iut, source, id);
74.Ed
75.Sh SEE ALSO
76.Xr xo_syslog 3 ,
77.Xr xo_set_syslog_enterprise_id 3 ,
78.Xr xo_format 5 ,
79.Xr libxo 3
80