PHP Classes
elePHPant
Icontem

File: example_config.php

Recommend this page to a friend!
  Classes of Muhammad Arfeen  >  Log4PHP ElasticSearch Appender  >  example_config.php  >  Download  
File: example_config.php
Role: Example script
Content type: text/plain
Description: Log4php configuration for ElasticSearch Appender
Class: Log4PHP ElasticSearch Appender
Append log messages to ElasticSearch using Log4PHP
Author: By
Last change:
Date: 4 years ago
Size: 1,737 bytes
 

 

Contents

Class file image Download
<?php

/* a sample configuration code for log4php. XML config can be used in same way. */

$configarray = array(
   
   
'appenders' => array(
       
       
       
       
'ElasticSearch' => array(
           
'class' => 'LoggerAppenderElasticSearch',
           
'layout' => array(
               
'class' => 'LoggerLayoutPattern',
               
'params' => array(
                   
                   
'conversionPattern' => json_encode(array(
                   
                       
'level' => "%p",
                       
'ip' => "%X{ip}",
                       
'action' => "%X{actor_id}",
                       
'view' => "%X{view}",
                       
'class_context' => "%X{class_context}",
                       
"logtimestamp" => "%d{Y-m-d H:i:s}"
                   
))
                )
               
            ),
           
'params' => array(
               
'remoteHost' => 'localhost',
               
'port' => '9200',
               
'esIndex' => 'myindex',
               
'esType' => 'mytype'
               
           
),
           
'filters' => array(
                array(
                   
'class' => 'LoggerFilterLevelRange',
                   
'params' => array(
                       
'levelMin' => 'info',
                       
'levelMax' => 'fatal'
                   
)
                )
            )
        )
       
       
       
       
       
    ),
   
   
'rootLogger' => array(
       
'level' => 'ALL',
       
'appenders' => array(
           
'ElasticSearch'
       
)
       
    )
   
);



return
$configarray;

?>