15 |
our $user = 'dpavlin'; |
our $user = 'dpavlin'; |
16 |
our $log = '/tmp/sysplog.log'; |
our $log = '/tmp/sysplog.log'; |
17 |
|
|
18 |
require 'conf.pl' if -e 'conf.pl'; |
my $config = $0; |
19 |
|
$config =~ s{/[^/]+$}{/conf.pl}; |
20 |
|
if ( -e $config ) { |
21 |
|
require $config; |
22 |
|
warn "# using $config ", -s $config, $/; |
23 |
|
} |
24 |
|
|
25 |
my $debug = 0; |
my $debug = 0; |
26 |
my $schema = 0; |
my $schema = 0; |
47 |
id serial, |
id serial, |
48 |
timestamp timestamp default now(), |
timestamp timestamp default now(), |
49 |
ip inet not null, |
ip inet not null, |
50 |
hostname text not null, |
hostname text, |
51 |
message text, |
message text, |
52 |
level int, |
level int, |
53 |
facility int, |
facility int, |
93 |
}); |
}); |
94 |
|
|
95 |
my $sth_log_unparsed = $dbh->prepare(qq{ |
my $sth_log_unparsed = $dbh->prepare(qq{ |
96 |
insert into log (ip,hostname,messsage) values (?,?,?) |
insert into log (ip,hostname,message) values (?,?,?) |
97 |
}); |
}); |
98 |
|
|
99 |
|
|
112 |
|
|
113 |
_log "INFO: listen on $port"; |
_log "INFO: listen on $port"; |
114 |
|
|
|
my $rin = ''; |
|
115 |
my $buf; |
my $buf; |
116 |
while(1) { |
while(1) { |
117 |
$sock->recv($buf, $MAXLEN); |
$sock->recv($buf, $MAXLEN); |