tcl-syslog(3tcl)

tcl-syslog3tcl

Syslog interface for tcl

Usage

package require syslog

syslog ?-ident ident? ?-facility facility? ?-pid? ?-perror? priority message
Returns: nothing

Overview

This project provides a Tcl interface to the standard *nix syslog service. It implements a Tcl package that exports the full functionality of the underlying syslog facility to the Tcl programming language. This includes local and remote logging.

Syslog is a standard for forwarding log messages in an IP network. It is also used to refer to the implementation of this standard and API, that supports both remote and local logging. It is typically used for computer system management and security auditing; usually to aggregate log messages in a central repository. It is standardized within the Syslog working group of the IETF.

Syslog is available in all POSIX compliant and POSIX-like Operating Systems.

-ident is a optional string argument that is used by syslog to differentiate between processes and log contexts. It is up to the user to specify any string here.

-pid prints also the process pid in the log message

-perror prints the message also to stderr

-facility is an optional string dictated by syslog, and categorizes the entity that logs the message, in the following categories/facilities:

       Facility    Description
       auth        security/authorization messages
       authpriv    security/authorization messages (private)
       cron        clock daemon (cron and at)
       daemon      system daemons without separate facility value
       ftp         ftp daemon
       kern        kernel messages
       local[0-7]  local0 to local7 are reserved for local use
       lpr         line printer subsystem
       mail        mail subsystem
       news        USENET news subsystem
       syslog      messages generated internally by syslogd(8)
       user        generic user-level messages
       uucp        UUCP subsystem

The default facility is "user".

priority is another string dictated by syslog, that describes the severity of the message. In order of higher to lower severity, the possible strings are:

       Priority    Description
       emergency   system is unusable
       alert       action must be taken immediately
       critical    critical conditions
       error       error conditions
       warning     warning conditions
       notice      normal, but significant, condition
       info        informational message
       debug       debug-level message

This argument is mandatory.

Examples

package require syslog
syslog critical "Message 1"
syslog -ident tclsh warning "Message 2"
syslog -facility local0 notice "Message 3"
syslog -ident tclsh -facility user error "Message 4"
syslog -pid critical "Message 5.0"
syslog -pid -ident tclsh critical "Message 5.1"
syslog -pid -facility local0 debug "Message 5.1"
syslog -pid -facility local1 -ident tclsh info "Message 5.2"
syslog -pid -ident tclsh -facility local2 warning "Message 5.3"
Outputs in /var/log/syslog (syslog timestamps and line prefix removed) :
 tclsh: Message 1
 tclsh: Message 2
 tclsh: Message 3
 testident: Message 4
 tclsh[7049]: Message 5.0
 my_ident[7049]: Message 5.1
 tclsh[7049]: Message 5.1
 my_ident[7049]: Message 5.2
 my_ident[7049]: Message 5.3

Author

Alexandros Stergiakis [email protected]
Massimo Manghi [email protected]

From tcl-syslog 1.2.6-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.