NAME
Log::Log4perl::Layout::GELF - Log4perl for graylog2
VERSION
Version 0.01
SYNOPSIS
Log4perl implementation of GELF. When used with Log::Log4perl::Appender::Socket you can log directly to a graylog2 server.
Code snippet. Replace the ip with your graylog server.
use Log::Log4perl
my $logger_conf = {
'log4perl.logger.graylog' => "DEBUG, SERVER",
'log4perl.appender.SERVER' => "Log::Log4perl::Appender::Socket",
'log4perl.appender.SERVER.PeerAddr' => '10.211.1.94',
'log4perl.appender.SERVER.PeerPort' => "12201",
'log4perl.appender.SERVER.Proto' => "udp",
'log4perl.appender.SERVER.layout' => "GELF"
};
Log::Log4perl->init( $logger_conf );
my $LOGGER = Log::Log4perl->get_logger('graylog');
$LOGGER->debug("Debug log");
...
SUBROUTINES/METHODS
new
Can take most of options that Log::Log4perl::Layout::PatternLayout can.
Additional Options:
PlainText - outputs plaintext and not gzipped files.
render
Wraps the Log::Log4perl::Layout::PatternLayout return value so we can
gzip the JSON string.