Plack::Middleware::AccessLog::Structured::ZeroMQ - Access log middleware which passes structured log messages into ZeroMQ
version 0.001000
use Plack::Middleware::AccessLog::Structured::ZeroMQ; Plack::Middleware::AccessLog::Structured::ZeroMQ->wrap($app, connect => 'tcp://127.0.0.1:5552', callback => sub { my ($env, $message) = @_; $message->{foo} = 'bar'; return $message; }, extra_field => { 'some.application.field' => 'log_field', 'some.psgi-env.field' => 'another_log_field', }, );
Plack::Middleware::AccessLog::Structured::ZeroMQ is a Plack::Middleware which sends structured, JSON-encoded log messages into a ZeroMQ message queue. It is a subclass of Plack::Middleware::AccessLog::Structured and thus uses its log messages.
Constructor, creates new instance. See also the base class Plack::Middleware::AccessLog::Structured for additional parameters. Please note that you should not pass the logger parameter to Plack::Middleware::AccessLog::Structured::ZeroMQ as that would override the default of passing log messages into ZeroMQ.
logger
This method expects its parameters as a hash reference.
The address of the ZeroMQ endpoint to send the data to. Defaults to tcp://127.0.0.1:5552.
tcp://127.0.0.1:5552
A fresh instance of the middleware.
Plack::Middleware
Plack::Middleware::AccessLog::Structured, the base class for this middleware.
Message::Passing, especially Message::Passing::Output::ZeroMQ which is used by this middleware.
In order to receive log messages with Message::Passing, one can use a command like the following:
message-pass --input ZeroMQ --input_options '{"socket_bind":"tcp://*:5552"}' \ --output STDOUT
Message::Passing::Output::ElasticSearch which can serve as an output for Message::Passing to store the log messages into ElasticSearch.
In order to pass log messages to ElasticSearch, a command like the following can be used:
message-pass --input ZeroMQ --input_options '{"socket_bind":"tcp://*:5552"}' \ --output ElasticSearch --output_options '{"elasticsearch_servers":["127.0.0.1:9200"]}' \ --encoder Null
Manfred Stock <mstock@cpan.org>
This software is copyright (c) 2012 by Manfred Stock.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Plack::Middleware::AccessLog::Structured::ZeroMQ, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Plack::Middleware::AccessLog::Structured::ZeroMQ
CPAN shell
perl -MCPAN -e shell install Plack::Middleware::AccessLog::Structured::ZeroMQ
For more information on module installation, please visit the detailed CPAN module installation guide.