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

Private Attributes

string $appname
 
string $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
Note
© 2015 Wikimedia Foundation and contributors

Definition at line 49 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 71 of file SyslogHandler.php.

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

Member Function Documentation

◆ makeCommonSyslogHeader()

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

Definition at line 84 of file SyslogHandler.php.

Member Data Documentation

◆ $appname

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

◆ $hostname

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: