2017 © Pedro Peláez
 

library log4php-graylog2

Log4php appenders and layouts for compatibility with graylog2

image

dulyanov/log4php-graylog2

Log4php appenders and layouts for compatibility with graylog2

  • Wednesday, January 27, 2016
  • by d-ulyanov
  • Repository
  • 2 Watchers
  • 11 Stars
  • 28,198 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 9 Forks
  • 1 Open issues
  • 7 Versions
  • 14 % Grown

The README.md

=====, (*1)

About

Copyright (c) 2012-2016 Dmitriy Ulyanov, (*2)

Here you can find 2 new appenders for log4php: LoggerAppenderAMQP and LoggerAppenderGraylog2. You can pass log messages to Graylog2 or AMQP (RabbitMQ for ex.) using it., (*3)

Appender LoggerAppenderGraylog2 can pass messages directly to Graylog2 server. Appender LoggerAppenderAMQP can pass messages to AMQP Server. In this case you can set up yours graylog2 to recieving messages from AMQP., (*4)

If you would like to pass messages in GELF format, use special layout: LoggerLayoutGelf, (*5)

============, (*6)

Installation


For composer users, (*7)


  1. Add to your composer.json:, (*8)

    {
     "require": {
         "dulyanov/log4php-graylog2": "~1.0"
     },
     "repositories": [
         {
             "type": "vcs",
             "url": "https://github.com/d-ulyanov/log4php-graylog2.git"
         }
     ]
    }
    
  2. Run composer.phar update, (*9)


For other users, (*10)


  1. Set up your log4php config file (see exampleConfig.xml)
  2. Use your new logger:, (*11)

    require 'log4php/Logger.php';
    require 'log4php-graylog2/src/main/php/bootstrap.php';
    

=============, (*12)

Configuration


XML, (*13)


<configuration xmlns="http://logging.apache.org/log4php/">
    <appender name="MyAMQPAppender" class="LoggerAppenderAMQP">
        <param name="host" value="example.com" />
        <param name="port" value="5672" />
        <param name="vhost" value="/logs" />
        <param name="login" value="my_login" />
        <param name="password" value="my_secret_password" />
        <param name="exchangeName" value="my_exchange" />
        <param name="routingKey" value="php_application" />
        <param name="contentType" value="application/json" />
        <layout class="LoggerLayoutGelf" />
    </appender>
    <appender name="MyGraylog2Appender" class="LoggerAppenderGraylog2">
        <param name="host" value="192.168.1.123" />
        <param name="port" value="12201" />
        <layout class="LoggerLayoutGelf" />
    </appender>
    <root>
        <level value="DEBUG" />
        <appender_ref ref="MyAMQPAppender" />
        <appender_ref ref="MyGraylog2Appender" />
    </root>
</configuration>

PHP, (*14)


array(
    'rootLogger' => array(
        'appenders' => array('MyAMQPAppender', 'MyGraylog2Appender')
    ),
    'appenders' => array(
        'MyAMQPAppender' => array(
            'class' => 'LoggerAppenderAMQP',
            'params' => array(
                'host' => 'example.com',
                'port' => 5672,
                'vhost' => '/logs',
                'login' => 'my_login',
                'password' => 'my_secret_password',
                'exchangeName' => 'my_exchange',
                'routingKey' => 'php_application',
                'contentType' => 'application/json'
            ),
            'layout' => array(
                'class' => 'LoggerLayoutGelf'
            )
        ),
        'MyGraylog2Appender' => array(
            'class' => 'LoggerAppenderGraylog2',
            'params' => array(
                'host' => '192.168.1.123',
                'port' => 12201
            ),
            'layout' => array(
                'class' => 'LoggerLayoutGelf'
            )
        ),
    ),
);

=====, (*15)

Usage

Logger::configure('exampleConfig.xml', 'LoggerConfigurationAdapterXML');

$myLogger = Logger::getLogger('MyLogger');
$myLogger->debug("Hello world!");

The Versions

27/01 2016

dev-master

9999999-dev https://github.com/d-ulyanov/log4php-graylog2

Log4php appenders and layouts for compatibility with graylog2

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Dmitry Ulyanov

log php logging graylog2

27/01 2016

1.0.4

1.0.4.0 https://github.com/d-ulyanov/log4php-graylog2

Log4php appenders and layouts for compatibility with graylog2

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Dmitry Ulyanov

log php logging graylog2

04/09 2015

1.0.3

1.0.3.0 https://github.com/d-ulyanov/log4php-graylog2

Log4php appenders and layouts for compatibility with graylog2

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Dmitry Ulyanov

log php logging graylog2

30/04 2015

1.0.2

1.0.2.0 https://github.com/d-ulyanov/log4php-graylog2

Log4php appenders and layouts for compatibility with graylog2

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Dmitry Ulyanov

log php logging graylog2

21/04 2014

dev-develop

dev-develop https://github.com/d-ulyanov/log4php-graylog2

Log4php appenders and layouts for compatibility with graylog2

  Sources   Download

Apache-2.0

The Requires

 

by Dmitry Ulyanov

log php logging graylog2

21/04 2014

1.0.1

1.0.1.0 https://github.com/d-ulyanov/log4php-graylog2

Log4php appenders and layouts for compatibility with graylog2

  Sources   Download

Apache-2.0

The Requires

 

by Dmitry Ulyanov

log php logging graylog2

20/04 2014

1.0.0

1.0.0.0 https://github.com/d-ulyanov/log4php-graylog2

Log4php appenders and layouts for compatibility with graylog2

  Sources   Download

Apache-2.0

The Requires

 

by Dmitry Ulyanov

log php logging graylog2