Allow overriding short_message
This commit is contained in:
parent
2791d32e7c
commit
7fe03ce1a5
|
@ -168,12 +168,14 @@ while ( my $entry = <JOURNAL> ){
|
|||
# OR
|
||||
#
|
||||
# gelf(~):code=200~url=/index.html~remote_ip=10.99.5.12~referer=http://test.local/
|
||||
if ( $msg->{MESSAGE} =~ m/^gelf(\([^\(\)]+\))?:([a-zA-Z\d_\-]+=([^\|])\|?)+/ ){
|
||||
if ( $msg->{MESSAGE} =~ m/^gelf(\([^\(\)]+\))?:([a-zA-Z\d_\-]+=([^\|]+)\|?)+/ ){
|
||||
$msg->{MESSAGE} =~ s/^gelf(\([^\(\)]+\))?://;
|
||||
my $separator = ($1 && length $1 > 0) ? qr{$1} : qr{\|};
|
||||
foreach ( split /$separator/, $msg->{MESSAGE} ){
|
||||
my ( $key, $val ) = split /=/, $_;
|
||||
$gelf->{'_' . lc $key} = $val;
|
||||
my ( $key, $val ) = split /=/, $_, 2;
|
||||
# Allow overriding short message
|
||||
$key = '_' . $key unless ($key eq 'short_message');
|
||||
$gelf->{$key} = $val;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue