Skip to content

bankiru/monolog-logstash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Monolog Logstash - logging to Logstash Build Status Coverage Status Scrutinizer Code Quality SensioLabsInsight

Latest Stable Version Total Downloads Latest Unstable Version License

Installing

Composer

"require": {
  "bankiru/monolog-logstash": "~0.1.0"
}

Github

Releases available on Github.

Documentation

Currently implemented:

ZMQ transport

<?php

use Bankiru\MonologLogstash\ZMQHandler;
use Monolog\Formatter\JsonFormatter;

$zmqHandler = new ZMQHandler(
    'tcp://127.0.0.1:2120', // dsn
     true,                  // persistent
     [],                    // ZMQContext options (http://php.net/manual/en/zmqcontext.setopt.php)
     \ZMQ::SOCKET_PUSH,     // ZMQSocket type
     [],                    // ZMQSocket options (http://php.net/manual/en/zmqsocket.setopt.php)
     Logger::INFO,          // log level
     true                   // bubble
);

$zmqHandler->setFormatter(new JsonFormatter(JsonFormatter::BATCH_MODE_NEWLINES)); // optional but recommended

$log = new Logger('name');
$log->pushHandler($zmqHandler);

Lumberjack transport

<?php

use Bankiru\MonologLogstash\LumberjackHandler;
use Bankiru\MonologLogstash\LumberjackFormatter;
use Ekho\Logstash\Lumberjack;

$lumberjackHandler = new LumberjackHandler(Logger::INFO, true);
$lumberjackHandler->init(
    '127.0.0.1',
    2323,
    'path/to/certificate.crt',
    [
        'window_size' => 5000,
    ]
);
$lumberjackHandler->setFormatter(new LumberjackFormatter('my_app_name'));

$log = new Logger('name');
$log->pushHandler($lumberjackHandler);

About

ZeroMQ Logstash transport for Monolog

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •