|
tcl−syslog − Syslog interface for Tcl |
|
package require syslog syslog ?−ident ident?
?−facility facility? priority
message |
|
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 Tcl string here. 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
lrp 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.
|
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"
if {! [catch {syslog −ident tclsh −facility user3 error "Message"}]} {
error
}
if {! [catch {syslog −ident tclsh −facility user error3 "Message"}]} {
error
}
|
In /var/log/messages: Feb 29 14:03:15 localhost tclsh: Message 1 Feb 29 14:03:15 localhost tclsh: Message 2 Feb 29 14:03:55 localhost tclsh: Message 1 Feb 29 14:03:55 localhost tclsh: Message 2 Feb 29 14:03:55 localhost tclsh: Message 3 |
|
Alexandros Stergiakis sterg@kth.se |
|
Copyright (C) 2008 Alexandros Stergiakis This program is free software: you can redistribute it
and/or This program is distributed in the hope that it will be
useful, You should have received a copy of the GNU General Public
License |