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