xref: /netbsd-src/share/man/man3lua/syslog.3lua (revision c3ad0bdd7e8e54af40c917ad2f8ffaef552150f3)
1*c3ad0bddSandvar.\"	$NetBSD: syslog.3lua,v 1.4 2022/10/15 21:53:21 andvar Exp $
2853a3f51Smbalmer.\"
38905acc6Smbalmer.\" Copyright (c) 2013, 2014 Marc Balmer <mbalmer@NetBSD.org>.
48905acc6Smbalmer.\" All rights reserved.
5853a3f51Smbalmer.\"
6853a3f51Smbalmer.\" Redistribution and use in source and binary forms, with or without
7853a3f51Smbalmer.\" modification, are permitted provided that the following conditions
8853a3f51Smbalmer.\" are met:
9853a3f51Smbalmer.\" 1. Redistributions of source code must retain the above copyright
10853a3f51Smbalmer.\"    notice, this list of conditions and the following disclaimer.
11853a3f51Smbalmer.\" 2. Redistributions in binary form must reproduce the above copyright
12853a3f51Smbalmer.\"    notice, this list of conditions and the following disclaimer in the
13853a3f51Smbalmer.\"    documentation and/or other materials provided with the distribution.
14853a3f51Smbalmer.\" 3. Neither the name of the University nor the names of its contributors
15853a3f51Smbalmer.\"    may be used to endorse or promote products derived from this software
16853a3f51Smbalmer.\"    without specific prior written permission.
17853a3f51Smbalmer.\"
18853a3f51Smbalmer.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19853a3f51Smbalmer.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20853a3f51Smbalmer.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21853a3f51Smbalmer.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22853a3f51Smbalmer.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23853a3f51Smbalmer.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24853a3f51Smbalmer.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25853a3f51Smbalmer.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26853a3f51Smbalmer.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27853a3f51Smbalmer.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28853a3f51Smbalmer.\" SUCH DAMAGE.
29853a3f51Smbalmer.\"
30853a3f51Smbalmer.\"
318905acc6Smbalmer.Dd January 7, 2014
32853a3f51Smbalmer.Dt SYSLOG 3lua
33853a3f51Smbalmer.Os
34853a3f51Smbalmer.Sh NAME
35853a3f51Smbalmer.Nm syslog
36853a3f51Smbalmer.Nd access
37853a3f51Smbalmer.Xr syslog 3
38853a3f51Smbalmerfunctionality from Lua
39853a3f51Smbalmer.Sh SYNOPSIS
408905acc6Smbalmer.Cd "local syslog = require 'syslog'"
41853a3f51Smbalmer.Pp
42853a3f51Smbalmer.Bl -tag -width XXXX -compact
43853a3f51Smbalmer.It Dv syslog.openlog(ident, logopt, facility)
44853a3f51Smbalmer.It Dv syslog.syslog(priority, message)
45853a3f51Smbalmer.It Dv syslog.closelog()
46853a3f51Smbalmer.It Dv oldmask = syslog.setlogmask(maskpri)
47853a3f51Smbalmer.El
48853a3f51Smbalmer.Sh DESCRIPTION
49853a3f51SmbalmerThe
50853a3f51Smbalmer.Nm
51853a3f51SmbalmerLua binding provides access to the
52853a3f51Smbalmer.Xr syslog 3
53*c3ad0bddSandvarfunctionality.
54853a3f51Smbalmer.Pp
55853a3f51Smbalmer.Bl -tag -width XXXX -compact
56853a3f51Smbalmer.Pp
57853a3f51Smbalmer.It Dv syslog.openlog(ident, logopt, facility)
58853a3f51SmbalmerThe syslog.openlog() function provides for more specialized processing of the
59853a3f51Smbalmermessages sent by syslog.syslog().
60853a3f51SmbalmerThe parameter
61853a3f51Smbalmer.Ar ident
62853a3f51Smbalmeris a string that will be prepended to every message.
63853a3f51SmbalmerThe
64853a3f51Smbalmer.Ar logopt
65853a3f51Smbalmerargument is a bit field specifying logging options, which is formed
66853a3f51Smbalmerby adding one or more of the following values:
67853a3f51Smbalmer.Pp
68853a3f51Smbalmer.Bl -tag -width XXXX -compact
69853a3f51Smbalmer.It Dv syslog.LOG_CONS
70853a3f51SmbalmerIf
71853a3f51Smbalmer.Fn syslog.syslog
72853a3f51Smbalmercannot pass the message to syslogd(8) it will attempt to write the
73853a3f51Smbalmermessage to the console (``/dev/console'').
74853a3f51Smbalmer.Pp
75853a3f51Smbalmer.It Dv syslog.LOG_NDELAY
76853a3f51SmbalmerOpen the connection to syslogd(8) immediately.
77853a3f51SmbalmerNormally the open is delayed until the first message is logged.
78853a3f51SmbalmerUseful for programs that need to manage the order in which file descriptors are
79853a3f51Smbalmerallocated.
80853a3f51Smbalmer.Pp
81853a3f51Smbalmer.It Dv syslog.LOG_PERROR
82853a3f51SmbalmerWrite the message to standard error output as well to the system log.
83853a3f51Smbalmer.Pp
84853a3f51Smbalmer.It Dv syslog.LOG_PID
85853a3f51SmbalmerLog the process id with each message: useful for identifying instantiations of
86853a3f51Smbalmerdaemons.
87853a3f51Smbalmer(This PID is placed within brackets between the ident and the message.)
88853a3f51Smbalmer.El
89853a3f51Smbalmer.Pp
90853a3f51SmbalmerThe facility parameter encodes a default facility to be assigned to all
91853a3f51Smbalmermessages that do not have an explicit facility encoded:
92853a3f51Smbalmer.Pp
93853a3f51Smbalmer.Bl -tag -width XXXX -compact
94853a3f51Smbalmer.It Dv syslog.LOG_AUTH
95853a3f51SmbalmerThe authorization system: login(1), su(1), getty(8), etc.
96853a3f51Smbalmer.Pp
97853a3f51Smbalmer.It Dv syslog.LOG_AUTHPRIV
98853a3f51SmbalmerThe same as LOG_AUTH, but logged to a file readable only by selected
99853a3f51Smbalmerindividuals.
100853a3f51Smbalmer.Pp
101853a3f51Smbalmer.It Dv syslog.LOG_CRON
102853a3f51SmbalmerThe cron daemon: cron(8).
103853a3f51Smbalmer.Pp
104853a3f51Smbalmer.It Dv syslog.LOG_DAEMON
105853a3f51SmbalmerSystem daemons, such as routed(8), that are not provided for explicitly by other
106853a3f51Smbalmerfacilities.
107853a3f51Smbalmer.Pp
108853a3f51Smbalmer.It Dv syslog.LOG_FTP
109853a3f51SmbalmerThe file transfer protocol daemon: ftpd(8).
110853a3f51Smbalmer.Pp
111853a3f51Smbalmer.It Dv syslog.LOG_KERN
112853a3f51SmbalmerMessages generated by the kernel.
113853a3f51SmbalmerThese cannot be generated by any user processes.
114853a3f51Smbalmer.Pp
115853a3f51Smbalmer.It Dv syslog.LOG_LPR
116853a3f51SmbalmerThe line printer spooling system: lpr(1), lpc(8), lpd(8), etc.
117853a3f51Smbalmer.Pp
118853a3f51Smbalmer.It Dv syslog.LOG_MAIL
119853a3f51SmbalmerThe mail system.
120853a3f51Smbalmer.Pp
121853a3f51Smbalmer.It Dv syslog.LOG_NEWS
122853a3f51SmbalmerThe network news system.
123853a3f51Smbalmer.Pp
124853a3f51Smbalmer.It Dv syslog.LOG_SYSLOG
125853a3f51SmbalmerMessages generated internally by syslogd(8).
126853a3f51Smbalmer.Pp
127853a3f51Smbalmer.It Dv syslog.LOG_USER
128853a3f51SmbalmerMessages generated by random user processes.
129853a3f51SmbalmerThis is the default facility identifier if none is specified.
130853a3f51Smbalmer.Pp
131853a3f51Smbalmer.It Dv syslog.LOG_UUCP
132853a3f51SmbalmerThe uucp system.
133853a3f51Smbalmer.Pp
134853a3f51Smbalmer.It Dv syslog.LOG_LOCAL0
135853a3f51SmbalmerReserved for local use.
136853a3f51SmbalmerSimilarly for syslog.LOG_LOCAL1 through syslog.LOG_LOCAL7
137853a3f51Smbalmer.El
138853a3f51Smbalmer.Pp
139853a3f51Smbalmer.It Dv syslog.syslog(priority, message)
140853a3f51SmbalmerThe
141853a3f51Smbalmer.Fn syslog
142853a3f51Smbalmerfunction writes
143853a3f51Smbalmer.Ar message
144853a3f51Smbalmerto the system message logger.
145853a3f51SmbalmerThe message is then written to the system console, log files, logged-in
146853a3f51Smbalmerusers, or forwarded to other machines as appropriate (see syslogd(8)).
147853a3f51Smbalmer.Pp
148853a3f51SmbalmerThe
149853a3f51Smbalmer.Ar message
150853a3f51Smbalmeris tagged with
151853a3f51Smbalmer.Ar priority .
152853a3f51SmbalmerPriorities are encoded as a
153853a3f51Smbalmer.Ar facility
154853a3f51Smbalmerand a
155853a3f51Smbalmer.Ar level .
156853a3f51SmbalmerThe facility describes the part of the system generating the message.
157853a3f51SmbalmerThe level is selected from the following ordered (high to low) list:
158853a3f51Smbalmer.Pp
159853a3f51Smbalmer.Bl -tag -width XXXX -compact
160853a3f51Smbalmer.It Dv syslog.LOG_EMERG
161853a3f51SmbalmerA panic condition.
162853a3f51SmbalmerThis is normally broadcast to all users.
163853a3f51Smbalmer.Pp
164853a3f51Smbalmer.It Dv syslog.LOG_ALERT
165853a3f51SmbalmerA condition that should be corrected immediately, such as a corrupted system
166853a3f51Smbalmerdatabase.
167853a3f51Smbalmer.Pp
168853a3f51Smbalmer.It Dv syslog.LOG_CRIT
169853a3f51SmbalmerCritical conditions, e.g., hard device errors.
170853a3f51Smbalmer.Pp
171853a3f51Smbalmer.It Dv syslog.LOG_ERR
172853a3f51SmbalmerErrors.
173853a3f51Smbalmer.Pp
174853a3f51Smbalmer.It Dv syslog.LOG_WARNING
175853a3f51SmbalmerWarning messages.
176853a3f51Smbalmer.Pp
177853a3f51Smbalmer.It Dv syslog.LOG_NOTICE
178853a3f51SmbalmerConditions that are not error conditions, but should possibly be handled
179853a3f51Smbalmerspecially.
180853a3f51Smbalmer.Pp
181853a3f51Smbalmer.It Dv syslog.LOG_INFO
182853a3f51SmbalmerInformational messages.
183853a3f51Smbalmer.Pp
184853a3f51Smbalmer.It Dv syslog.LOG_DEBUG
185853a3f51SmbalmerMessages that contain information normally of use only when debugging a program.
186853a3f51Smbalmer.El
187853a3f51Smbalmer.Pp
188853a3f51Smbalmer.It Dv syslog.closelog()
189853a3f51SmbalmerThe
190853a3f51Smbalmer.Fn syslog.closelog
191853a3f51Smbalmerfunction can be used to close the log file.
192853a3f51Smbalmer.Pp
193853a3f51Smbalmer.It Dv oldmask = syslog.setlogmask(maskpri)
194853a3f51SmbalmerThe
195853a3f51Smbalmer.Fn setlogmask
196853a3f51Smbalmerfunction sets the log priority mask to maskpri and returns the previous mask.
197853a3f51SmbalmerCalls to
198853a3f51Smbalmer.Fn syslog
199853a3f51Smbalmerwith a priority not set in maskpri are rejected.
200853a3f51Smbalmer.El
201853a3f51Smbalmer.Sh SEE ALSO
202853a3f51Smbalmer.Xr lua 1 ,
203853a3f51Smbalmer.Xr luac 1 ,
204853a3f51Smbalmer.Xr syslog 3 ,
205f5b7cc34Swiz.Xr intro 3lua ,
206853a3f51Smbalmer.Xr syslogd 8
207853a3f51Smbalmer.Sh HISTORY
208853a3f51SmbalmerA
209853a3f51Smbalmer.Nm
210853a3f51SmbalmerLua binding manual appeared in
211853a3f51Smbalmer.Nx 7.0 .
212853a3f51Smbalmer.Sh AUTHORS
213853a3f51Smbalmer.An -nosplit
214853a3f51SmbalmerThe
215853a3f51Smbalmer.Nm
216853a3f51SmbalmerLua binding was written by
217853a3f51Smbalmer.An Marc Balmer Aq Mt mbalmer@NetBSD.org .
218