]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/libxo/libxo/xo_syslog.3
Import libxo-0.9.0:
[FreeBSD/FreeBSD.git] / contrib / libxo / libxo / xo_syslog.3
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
31 The
32 .Fn xo_syslog
33 function creates log entries following the standard defined in
34 RFC5424.
35 These messages are sent to the log
36 .Xr syslogd 8
37 daemon, where they can be filtered, forwarded, and archived.
38 .Nm libxo
39 format strings are used to create both the message text and the
40 .Nm SD-PARAMS
41 content, containing name/value pairs that can be parsed by suitable
42 automation software.
43 .Pp
44 Refer to
45 .Xr xo_format 5
46 for basic information about formatting strings.
47 .Nm xo_syslog
48 encodes all value fields at SD-PARAMS within the syslog message.
49 An exception is made for fields with the "{d:}" modifier; such fields
50 appear in the message text only, with fields with the "{e:}" modifier
51 appear as SD-PARAMS, but not in the message text.
52 .Pp
53 .Fn xo_vsyslog
54 accepts a
55 .Fa va_list
56 for additional flexibility.
57 .Pp
58 .Fn xo_open_log ,
59 .Fn xo_close_log , and
60 .Fn xo_set_logmask
61 are all analogous to their libs counterparts,
62 .Xr openlog 3 ,
63 .Xr closelog 3 , and
64 .Xr setlogmask 3 .
65 The extra underscores in the names are unfortunate, but keep
66 consistency in
67 .Nm libxo
68 function 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 .Sh HISTORY
81 The
82 .Nm libxo
83 library first appeared in
84 .Fx 11.0 .
85 .Sh AUTHORS
86 .Nm libxo
87 was written by
88 .An Phil Shafer Aq Mt phil@freebsd.org .
89