/[sysplogd]/sysplogd
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /sysplogd

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 11 by dpavlin, Sat Apr 11 11:42:04 2009 UTC revision 14 by dpavlin, Sat Apr 11 12:59:28 2009 UTC
# Line 8  use Data::Dump qw/dump/; Line 8  use Data::Dump qw/dump/;
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,
# Line 40  CREATE TABLE log ( Line 47  CREATE TABLE log (
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,
# Line 86  my $sth_log_full = $dbh->prepare(qq{ Line 93  my $sth_log_full = $dbh->prepare(qq{
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    
# Line 105  sub _log { Line 112  sub _log {
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);

Legend:
Removed from v.11  
changed lines
  Added in v.14

  ViewVC Help
Powered by ViewVC 1.1.26