Log::Radis - Radis is a graylog logging radio through a redis database
version 0.003
# default values shown below my $radis = Log::Radis->new( server => 'localhost:6379', reconnect => 5, every => 1, queue => 'graylog-radis:queue', ); $radis->log(error => "This is a non-urgent error");
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 Redis DB server we should connect to. Defaults to localhost:6379.
localhost:6379
See "server" in Redis for allowed values.
Re-try connecting to the Redis DB up to reconnect seconds. 0 disables auto-reconnect.
0
See "reconnect" in Redis for more information.
Re-try connection to the Redis DB every every milliseconds.
See "every" in Redis for more information.
The name of the list, which gelf streams are pushed to. Defaults to graylog-radis:queue.
graylog-radis:queue
Set or get the Redis instance. Defaults to an instance of Redis. Any blessed object which implements the method lpush is allowed.
lpush
For your own Redis implementation use this attribute in the constructor. That should work:
my $redis = AnyEvent::Redis->new(...); my $radis = Log::Radis->new(redis => $redis); my $cv = $radis->log(...); $cv->recv;
$radis->log($level, $message, %additional_gelf_params); $radis->log(alert => "This is an alert!"); $radis->log(notice => "Look at this.", additional_param => $additional_value);
Additional GELF params must be prefixed with an underscore - but this method does that for you.
Overrides are only allowed for host/hostname and timestamp/time params. They defaults to the system hostname and the current timestamp from "time" in Time::HiRes.
$radis->push({ ... });
Raw-push a gelf message onto queue. If the argument is not a HashRef, it will be encoded to a JSON string.
The input is not validated, so be careful what you push onto the queue.
These levels are known and supposed to be compatible to various other logging engines.
Identifier | Numeric level -----------+-------------- fatal | 1 emerg | 1 emergency | 1 -----------+--- alert | 2 -----------+--- crit | 3 critical | 3 -----------+--- error | 4 err | 4 -----------+--- warn | 5 warning | 5 -----------+--- note | 6 notice | 6 -----------+--- info | 7 -----------+--- debug | 8 -----------+--- trace | 9 core | 9
Please report any bugs or feature requests on the bugtracker website https://github.com/zurborg/liblog-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.
David Zurborg <zurborg@cpan.org>
This software is Copyright (c) 2016 by David Zurborg.
This is free software, licensed under:
The ISC License
To install Log::Radis, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Log::Radis
CPAN shell
perl -MCPAN -e shell install Log::Radis
For more information on module installation, please visit the detailed CPAN module installation guide.