--- sysplogd 2009/04/11 11:45:36 12 +++ sysplogd 2009/04/11 12:59:28 14 @@ -15,7 +15,12 @@ our $user = 'dpavlin'; our $log = '/tmp/sysplog.log'; -require 'conf.pl' if -e 'conf.pl'; +my $config = $0; +$config =~ s{/[^/]+$}{/conf.pl}; +if ( -e $config ) { + require $config; + warn "# using $config ", -s $config, $/; +} my $debug = 0; my $schema = 0; @@ -42,7 +47,7 @@ id serial, timestamp timestamp default now(), ip inet not null, - hostname text not null, + hostname text, message text, level int, facility int, @@ -88,7 +93,7 @@ }); my $sth_log_unparsed = $dbh->prepare(qq{ - insert into log (ip,hostname,messsage) values (?,?,?) + insert into log (ip,hostname,message) values (?,?,?) }); @@ -107,7 +112,6 @@ _log "INFO: listen on $port"; -my $rin = ''; my $buf; while(1) { $sock->recv($buf, $MAXLEN);