MediaWiki master
MediaWiki\Logger\Monolog\SyslogHandler Class Reference

Write logs to a syslog server, using RFC 3164 formatted UDP packets. More...

Inherits SyslogUdpHandler.

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 (int $severity, DateTimeInterface $datetime)
 

Detailed Description

Write logs to a syslog server, using RFC 3164 formatted UDP packets.

This builds on Monolog's SyslogUdpHandler, which creates only a partial RFC 5424 header (PRI and VERSION), with rest intending to come from a specifically configured LineFormatter.

This makes use of SyslogUdpHandler it impossible with a formatter like \Monolog\Formatter\LogstashFormatter. Additionally, the direct syslog input for Logstash requires and accepts only RFC 3164 formatted packets.

This is a complete syslog handler and should work with any formatter. The formatted message will be prepended with a complete RFC 3164 message header and a partial message body. The resulting packet looks 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
Note
© 2015 Wikimedia Foundation and contributors

Definition at line 51 of file SyslogHandler.php.

Constructor & Destructor Documentation

◆ __construct()

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
int$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 66 of file SyslogHandler.php.

Member Function Documentation

◆ makeCommonSyslogHeader()

MediaWiki\Logger\Monolog\SyslogHandler::makeCommonSyslogHeader ( int  $severity,
DateTimeInterface  $datetime 
)
protected

Definition at line 79 of file SyslogHandler.php.


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