NAME
Plack::Middleware::AccessLog::Structured::ZeroMQ - Access log middleware which passes structured log messages into ZeroMQ
VERSION
version 0.001001
SYNOPSIS
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',
},
);
DESCRIPTION
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.
METHODS
new
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.
Parameters
This method expects its parameters as a hash reference.
- connect
-
The address of the ZeroMQ endpoint to send the data to. Defaults to
tcp://127.0.0.1:5552
.
Result
A fresh instance of the middleware.
SEE ALSO
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
AUTHOR
Manfred Stock <mstock@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2016 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.