Add support for haproxy logs
This commit is contained in:
29
lib/haproxy_parser.pm
Normal file
29
lib/haproxy_parser.pm
Normal file
@@ -0,0 +1,29 @@
|
||||
package My::parser::haproxy_parser;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my $self = {};
|
||||
bless ($self, $class);
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub parser {
|
||||
my $self = shift;
|
||||
my $string = shift;
|
||||
my ($reply,$hostile,$host) = ("No match for $string",0,'');
|
||||
my $re_host = qr/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/;
|
||||
if($string =~ m/SSL handshake failure/) {
|
||||
$_ = $string;
|
||||
$reply = 'SSL handshake failure';
|
||||
$hostile = 1;
|
||||
PARSE:
|
||||
m/(\ ($re_host):[0-9]{1,6})/gcix && do {
|
||||
$host = $2;
|
||||
};
|
||||
}
|
||||
return { retval => 1, retmsg => $reply, hostile => $hostile, host => $host, string => $string };
|
||||
}
|
||||
|
||||
return 1;
|
||||
Reference in New Issue
Block a user