syslog

A Tcl interface to syslog can be found here: [1 ].

Victor Wagner also created a syslog package written in C: [2 ].

PT also offers a quick and dirty way of sending syslog datagrams on the ceptcl page.

EF I've made available a version of a pure Tcl syslog package in the half-bakery [3 ]. The package implements the whole RFC5424 and is able to send syslog events via TCP, UDP (as long as you have TclUDP installed) and UNIX domain sockets via the nc command line program (so it will only work on unix, but these sockets only exist on unix). The package has to revert to RFC 3164 when sending to UNIX sockets, thus possibly setting aside some of the parameters of the messages. Below is an example that exercises the package (providing your machine listen for TCP on 10514 and UDP on 514).

package require syslog

# Connect to a remote/local hosts
set tcp [::syslog::connect -host localhost -port 10514]
set udp [::syslog::connect -host localhost -port 514 -udp]
set ux [::syslog::connect -domain /dev/log]

# Create an application and give it an IANA enterprise ID, this is
# seldom used so [::syslog::application] works in most cases.
set a [::syslog::application -enterprise 32473]

# Bind the application to the domain socket and send a single message at
# the default priority.
::syslog::bind $a $ux
::syslog::log $a "Hello the beautiful simplified world"

# Bind to the TCP socket and send some more
::syslog::bind $a $tcp
::syslog::log $a "More to say??"

# Bind on UDP
::syslog::bind $a $udp

# Create a complex type to be used in structured data
set t [::syslog::type $a myType field1 field2]

# Prepare a message for sending, this time at another priority
set m [::syslog::message $a "Testing another more complex example" \
          -priority local0.info]
# Append structured data to the message, send it and then free memory.
::syslog::append $m [::syslog::element $t field1 45 field1 34 field2 78]
::syslog::send $m
::syslog::delete $m

tclsyslogd : syslogd with integrated Tcl interpreter; allows firing of custom Tcl proc for every message.

syslogbox : use with tclsyslogd to enable filtered syslog messages to be broadcast over network.