MediaWiki  1.29.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


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:


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

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

Definition at line 49 of file SyslogHandler.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Logger\Monolog\SyslogHandler::__construct (   $appname,
  $port = 514,
  $facility = LOG_USER,
  $level = Logger::DEBUG,
  $bubble = true 
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

◆ makeCommonSyslogHeader()

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

Definition at line 84 of file SyslogHandler.php.

Member Data Documentation

◆ $appname

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

◆ $hostname

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

Definition at line 59 of file SyslogHandler.php.

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