MediaWiki  1.28.1
MediaWiki\Logger\Monolog\SyslogHandler Class Reference

Log handler that supports sending log events to a syslog server using RFC 3164 formatted UDP packets. More...

Inheritance diagram for MediaWiki\Logger\Monolog\SyslogHandler:
Collaboration diagram for MediaWiki\Logger\Monolog\SyslogHandler:

Public Member Functions

 __construct ($appname, $host, $port=514, $facility=LOG_USER, $level=Logger::DEBUG, $bubble=true)
 

Protected Member Functions

 makeCommonSyslogHeader ($severity)
 

Private Attributes

 $appname
 
 $hostname
 

Detailed Description

Log handler that supports sending log events to a syslog server using RFC 3164 formatted UDP packets.

Monolog's SyslogUdpHandler creates a partial RFC 5424 header (PRI and VERSION) and relies on the associated formatter to complete the header and message payload. This makes using it with a fixed format formatter like \Monolog\Formatter\LogstashFormatter impossible. Additionally, the direct syslog input for Logstash only handles RFC 3164 syslog packets.

This Handler should work with any Formatter. The formatted message will be prepended with an RFC 3164 message header and a partial message body. The resulting packet will looks something like:

<PRI>DATETIME HOSTNAME PROGRAM: MESSAGE

This format works as input to rsyslog and can also be processed by the default Logstash syslog input handler.

Since
1.25
Author
Bryan Davis bd808.nosp@m.@wik.nosp@m.imedi.nosp@m.a.or.nosp@m.g
Note
© 2015 Bryan Davis and Wikimedia Foundation.

Definition at line 49 of file SyslogHandler.php.

Constructor & Destructor Documentation

MediaWiki\Logger\Monolog\SyslogHandler::__construct (   $appname,
  $host,
  $port = 514,
  $facility = LOG_USER,
  $level = Logger::DEBUG,
  $bubble = true 
)
Parameters
string$appnameApplication name to report to syslog
string$hostSyslog host
int$portSyslog port
int$facilitySyslog message facility
string$levelThe minimum logging level at which this handler will be triggered
bool$bubbleWhether the messages that are handled can bubble up the stack or not

Definition at line 71 of file SyslogHandler.php.

References MediaWiki\Logger\Monolog\SyslogHandler\$appname.

Member Function Documentation

MediaWiki\Logger\Monolog\SyslogHandler::makeCommonSyslogHeader (   $severity)
protected

Definition at line 84 of file SyslogHandler.php.

References $timestamp.

Member Data Documentation

string MediaWiki\Logger\Monolog\SyslogHandler::$appname
private
string MediaWiki\Logger\Monolog\SyslogHandler::$hostname
private

Definition at line 59 of file SyslogHandler.php.


The documentation for this class was generated from the following file: