NAME

Dancer2::Logger::Radis - Dancer2 logger engine for Log::Radis

VERSION

version 0.002

DESCRIPTION

Radis (from Radio and Redis) is a concept of caching GELF messages in a Redis DB. Redis provides a reliable queue via the (B)RPOPLPUSH command. See http://redis.io/commands/rpoplpush for more information about that mechanism.

The implementation of a Radis client is quite simple: just push a GELF message with the LPUSH command onto the queue. A collector fetches the messages from the queue and inserts them into a Graylog2 server, for example.

The current perl implementation is Log::Radis. This module is a simple wrapper for it.

ATTRIBUTES

server

The Redis DB server we should connect to. Defaults to localhost:6379.

See "server" in Log::Radis for allowed values.

reconnect

Re-try connecting to the Redis DB up to reconnect seconds. 0 disables auto-reconnect.

See "reconnect" in Log::Radis for more information.

every

Re-try connection to the Redis DB every every milliseconds.

See "every" in Log::Radis for more information.

queue

The name of the list, which gelf streams are pushed to. Defaults to graylog-radis:queue.

See "queue" in Log::Radis for more information.

METHODS

log

log($level, $message, %extras);

Nothing special, just like you'd expect.

CONFIGURATION

logger: 'Radis'
engines:
  logger:
    Radis:
      server: 'redis-server:6379'
      queue: 'my-own-radis-queue'

For allowed options see "ATTRIBUTES".

GELF MESSAGE

The log message cannot be formatted like described at "log_format" in Dancer2::Core::Role::Logger. Instead, the additioal values are passed into the GELF message directly. Currently this mapping is hard-coded into this module:

Dancer2 variable               | GELF param
-------------------------------+-----------
$$                             | _pid
$dsl->app_name                 | _source
$request->id                   | _http_id
$request->user                 | _http_user
$request->address              | _http_client
$request->method               | _http_method
$request->path                 | _http_path
$request->protocol             | _http_proto
$request->header('referer')    | _http_referer
$request->header('user_agent') | _http_useragent
$request->session->id          | _session_id

This may change in future.

BUGS

Please report any bugs or feature requests on the bugtracker website https://github.com/zurborg/libdancer2-logger-radis-perl/issues

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

AUTHOR

David Zurborg <zurborg@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2016 by David Zurborg.

This is free software, licensed under:

The ISC License