SysLog — instruct Interchange to log to Unix system's log (syslog)



The directive configures syslog(8) logging for Interchange.

Besides just tuning syslog facility and priority settings, it is also possible to specify external command to invoke for sending syslog messages. This also means it is possible to hook into the message logging system and route messages where ever you want. For example, a custom wrapper can be created to log to a database. See an example of it in the section called “EXAMPLES”.


Global directive


Example: Simple syslog setup

SysLog  command  /usr/bin/logger
SysLog  tag      int1
SysLog  alert    local3.warn
SysLog  warn
SysLog  info
SysLog  debug    local3.debug

The above would cause messages to be logged with the command /usr/bin/logger -t int1 -p local3.alert ....

The generated system log entries would look somewhat like the following:

Oct 26 17:30:11 bill int1: Config 'co' at server startup
Oct 26 17:30:11 bill int1: Config 'homefn' at server startup
Oct 26 17:30:11 bill int1: Config 'simple' at server startup
Oct 26 17:30:11 bill int1: Config 'test' at server startup
Oct 26 17:30:13 bill int1: START server (2345) (INET and UNIX)

Example: Sending facility 'local3' messages to appropriate log file

As you might know, messages sent using syslog reach the syslog daemon sooner or later. There, they are examined and "routed" to their final destination. For BSD-compatible syslog daemons, the configuration file is probably /etc/syslog.conf, and the configuration snippet needed to route Interchange messages to /var/log/interchange.log is as follows:

# Log local3 stuff to Interchange log
local3.*                /var/log/interchange.log

Example: Custom logging script for logging to a database

my $script_name = "logdatabase";
use DBI;
use Getopt::Std;
getopts('d:p:T:k:') or die "$script_name options: $@\n";
use vars qw/$opt_d $opt_p $opt_T $opt_k/;
my $dsn   = $opt_d || $ENV{DBI_DSN};
my $template = $opt_T
    || "insert into log values ('~~KEY~~', '~~LEVEL~~', '~~MSG~~')";
my $dbh = DBI->connect($dsn)
    or die "$script_name cannot connect to DBI: $DBI::errstr\n";
my %data;
$data{KEY} = $opt_k || '';
local ($/);
$data{MSG} = <>;
$data{LEVEL} = $opt_p || '';
$template =~ s/\~\~(\w+)\~\~/$dbh->quote($data{$1})/;
my $sth = $dbh->prepare($template)
    or die "$script_name error executing query: $template\n";
    or die "$script_name error executing query: $template\n";



SysLog is available in Interchange versions:

4.6.0-5.9.0 (git-head)


Interchange 5.9.0:

Source: lib/Vend/
Line 508

['SysLog',       'hash',            undef],

Source: lib/Vend/
Line 3186 (context shows lines 3186-3203)

sub parse_hash {
my($item,$settings) = @_;
if (! $settings) {
  return $HashDefaultBlank{$item} ? '' : {};

my $c;

if(defined $C) {
  $c = $C->{$item} || {};
else {
  no strict 'refs';
  $c = ${"Global::$item"} || {};

return hash_string($settings,$c);


Interchange Development Group


DebugFile(7ic), Logging(7ic), ErrorFile(7ic)

DocBook! Interchange!