xref: /netbsd-src/share/man/man3lua/syslog.3lua (revision eaac9e3d28859567590b7fef63a96c293f76dbf9)
1.\"	$NetBSD: syslog.3lua,v 1.1 2013/11/13 20:55:08 mbalmer Exp $
2.\"
3.\" Copyright (c) 2013 Marc Balmer <mbalmer@NetBSD.org>. All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\" 3. Neither the name of the University nor the names of its contributors
14.\"    may be used to endorse or promote products derived from this software
15.\"    without specific prior written permission.
16.\"
17.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27.\" SUCH DAMAGE.
28.\"
29.\"
30.Dd November 13, 2013
31.Dt SYSLOG 3lua
32.Os
33.Sh NAME
34.Nm syslog
35.Nd access
36.Xr syslog 3
37functionality from Lua
38.Sh SYNOPSIS
39.Cd "require 'syslog'"
40.Pp
41.Bl -tag -width XXXX -compact
42.It Dv syslog.openlog(ident, logopt, facility)
43.It Dv syslog.syslog(priority, message)
44.It Dv syslog.closelog()
45.It Dv oldmask = syslog.setlogmask(maskpri)
46.El
47.Sh DESCRIPTION
48The
49.Nm
50Lua binding provides access to the
51.Xr syslog 3
52funcionality.
53.Pp
54.Bl -tag -width XXXX -compact
55.Pp
56.It Dv syslog.openlog(ident, logopt, facility)
57The syslog.openlog() function provides for more specialized processing of the
58messages sent by syslog.syslog().
59The parameter
60.Ar ident
61is a string that will be prepended to every message.
62The
63.Ar logopt
64argument is a bit field specifying logging options, which is formed
65by adding one or more of the following values:
66.Pp
67.Bl -tag -width XXXX -compact
68.It Dv syslog.LOG_CONS
69If
70.Fn syslog.syslog
71cannot pass the message to syslogd(8) it will attempt to write the
72message to the console (``/dev/console'').
73.Pp
74.It Dv syslog.LOG_NDELAY
75Open the connection to syslogd(8) immediately.
76Normally the open is delayed until the first message is logged.
77Useful for programs that need to manage the order in which file descriptors are
78allocated.
79.Pp
80.It Dv syslog.LOG_PERROR
81Write the message to standard error output as well to the system log.
82.Pp
83.It Dv syslog.LOG_PID
84Log the process id with each message: useful for identifying instantiations of
85daemons.
86(This PID is placed within brackets between the ident and the message.)
87.El
88.Pp
89The facility parameter encodes a default facility to be assigned to all
90messages that do not have an explicit facility encoded:
91.Pp
92.Bl -tag -width XXXX -compact
93.It Dv syslog.LOG_AUTH
94The authorization system: login(1), su(1), getty(8), etc.
95.Pp
96.It Dv syslog.LOG_AUTHPRIV
97The same as LOG_AUTH, but logged to a file readable only by selected
98individuals.
99.Pp
100.It Dv syslog.LOG_CRON
101The cron daemon: cron(8).
102.Pp
103.It Dv syslog.LOG_DAEMON
104System daemons, such as routed(8), that are not provided for explicitly by other
105facilities.
106.Pp
107.It Dv syslog.LOG_FTP
108The file transfer protocol daemon: ftpd(8).
109.Pp
110.It Dv syslog.LOG_KERN
111Messages generated by the kernel.
112These cannot be generated by any user processes.
113.Pp
114.It Dv syslog.LOG_LPR
115The line printer spooling system: lpr(1), lpc(8), lpd(8), etc.
116.Pp
117.It Dv syslog.LOG_MAIL
118The mail system.
119.Pp
120.It Dv syslog.LOG_NEWS
121The network news system.
122.Pp
123.It Dv syslog.LOG_SYSLOG
124Messages generated internally by syslogd(8).
125.Pp
126.It Dv syslog.LOG_USER
127Messages generated by random user processes.
128This is the default facility identifier if none is specified.
129.Pp
130.It Dv syslog.LOG_UUCP
131The uucp system.
132.Pp
133.It Dv syslog.LOG_LOCAL0
134Reserved for local use.
135Similarly for syslog.LOG_LOCAL1 through syslog.LOG_LOCAL7
136.El
137.Pp
138.It Dv syslog.syslog(priority, message)
139The
140.Fn syslog
141function writes
142.Ar message
143to the system message logger.
144The message is then written to the system console, log files, logged-in
145users, or forwarded to other machines as appropriate (see syslogd(8)).
146.Pp
147The
148.Ar message
149is tagged with
150.Ar priority .
151Priorities are encoded as a
152.Ar facility
153and a
154.Ar level .
155The facility describes the part of the system generating the message.
156The level is selected from the following ordered (high to low) list:
157.Pp
158.Bl -tag -width XXXX -compact
159.It Dv syslog.LOG_EMERG
160A panic condition.
161This is normally broadcast to all users.
162.Pp
163.It Dv syslog.LOG_ALERT
164A condition that should be corrected immediately, such as a corrupted system
165database.
166.Pp
167.It Dv syslog.LOG_CRIT
168Critical conditions, e.g., hard device errors.
169.Pp
170.It Dv syslog.LOG_ERR
171Errors.
172.Pp
173.It Dv syslog.LOG_WARNING
174Warning messages.
175.Pp
176.It Dv syslog.LOG_NOTICE
177Conditions that are not error conditions, but should possibly be handled
178specially.
179.Pp
180.It Dv syslog.LOG_INFO
181Informational messages.
182.Pp
183.It Dv syslog.LOG_DEBUG
184Messages that contain information normally of use only when debugging a program.
185.El
186.Pp
187.It Dv syslog.closelog()
188The
189.Fn syslog.closelog
190function can be used to close the log file.
191.Pp
192.It Dv oldmask = syslog.setlogmask(maskpri)
193The
194.Fn setlogmask
195function sets the log priority mask to maskpri and returns the previous mask.
196Calls to
197.Fn syslog
198with a priority not set in maskpri are rejected.
199.El
200.Sh SEE ALSO
201.Xr lua 1 ,
202.Xr luac 1 ,
203.Xr intro 3lua ,
204.Xr syslog 3 ,
205.Xr syslogd 8
206.Sh HISTORY
207A
208.Nm
209Lua binding manual appeared in
210.Nx 7.0 .
211.Sh AUTHORS
212.An -nosplit
213The
214.Nm
215Lua binding was written by
216.An Marc Balmer Aq Mt mbalmer@NetBSD.org .
217