The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Log::Log4perl::Appender::Fluent - log appender writing to Fluentd

SYNOPSIS

  log4perl.category = INFO, Fluentd
  # ...
  log4perl.appender.Fluentd = Log::Log4perl::Appender::Fluent
  log4perl.appender.Fluentd.host = fluentd.example.net
  # this port is default for Fluentd
  #log4perl.appender.Fluentd.port = 24224
  log4perl.appender.Fluentd.hostname_field = source_host
  log4perl.appender.Fluentd.tag_prefix = example
  # these two options prevent the message from being stringified
  log4perl.appender.Fluentd.layout = Log::Log4perl::Layout::NoopLayout
  log4perl.appender.Fluentd.warp_message = 0

DESCRIPTION

Log::Log4perl::Appender::Fluent is a Log::Log4perl(3) appender plugin that provides output to Fluentd daemon. The plugin supports sending simple string messages, but it works way better when is provided with Log::Message::JSON(3) or Log::Message::Structured(3) object, because the structure of the message will be preserved.

USAGE

Following options are available in Log::Log4perl(3) config:

socket (default: none)

Path to UNIX socket, where Fluentd listens. If specified, communication with Fluentd instance will go through this socket, otherwise TCP protocol will be used.

host, port (default: localhost, 24224)

Fluentd instance's address. If neither host/port nor socket is specified, due to default values, TCP communication will take place.

message_field (default: message)

Communication with Fluentd imposes using hashes as messages. This option tells how should be named key if the message is not a Log::Message::JSON(3)/Log::Message::Structured(3) object.

hostname_field (default: none)

Fluentd on its own doesn't provide the information where the record comes from. Setting hostname_field will make this module to add (replace) necessary field in messages.

category_field, level_field (default: none, none)

These options, similarly to hostname_field, specify where to put message's category and level.

tag_prefix, tag (default: none, none)

If tag is set, this will be the tag for messages. If tag_prefix is set, message will have the tag set to this prefix plus message's category. If neither tag nor tag_prefix is set, message's tag is equal to category.

tag has the precedence from these two if both set.

NOTES

If the destination host is unavailable, this module may print error messages using warn().

AUTHOR

Stanislaw Klekot, <cpan at jarowit.net>

LICENSE AND COPYRIGHT

Copyright 2012 Stanislaw Klekot.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

SEE ALSO

http://fluentd.org/, Log::Log4perl(3), Log::Message::JSON(3), Log::Message::Structured(3).