8 |
use DBI; |
use DBI; |
9 |
use Getopt::Long; |
use Getopt::Long; |
10 |
|
|
11 |
my $port = 514; |
our $port = 514; |
12 |
|
our $MAXLEN = 1524; |
13 |
|
|
14 |
my $MAXLEN = 1524; |
our $dsn = 'DBI:Pg:dbname=syslog'; |
15 |
|
our $user = 'dpavlin'; |
16 |
|
our $log = '/tmp/sysplog.log'; |
17 |
|
|
18 |
|
my $config = $0; |
19 |
|
$config =~ s{/[^/]+$}{/conf.pl}; |
20 |
|
if ( -e $config ) { |
21 |
|
require $config; |
22 |
|
warn "# using $config ", -s $config, $/; |
23 |
|
} |
24 |
|
|
|
my $dsn = 'DBI:Pg:dbname=syslog;host=llin.lan'; |
|
|
my $user = 'dpavlin'; |
|
25 |
my $debug = 0; |
my $debug = 0; |
26 |
my $schema = 0; |
my $schema = 0; |
|
my $log = '/tmp/sysplog.log'; |
|
27 |
|
|
28 |
GetOptions( |
GetOptions( |
29 |
'debug+' => \$debug, |
'debug+' => \$debug, |
30 |
'schema!' => \$schema, |
'schema!' => \$schema, |
31 |
'log=s' => \$log, |
'log=s' => \$log, |
32 |
|
'port=i' => \$port, |
33 |
) || die "usage: $0 --debug --schema\n"; |
) || die "usage: $0 --debug --schema\n"; |
34 |
|
|
35 |
our $VERSION = '0.00'; |
our $VERSION = '0.00'; |
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); |