MediaWiki
master
|
LogstashFormatter squashes the base message array and the context and extras subarrays into one. More...
Public Member Functions | |
__construct (string $applicationName, ?string $systemName=null, string $extraKey='', string $contextKey='ctxt_', $version=self::V0) | |
TODO: See T247675 for removing this override. More... | |
format (array $record) | |
Public Attributes | |
const | V0 = 0 |
const | V1 = 1 |
Protected Member Functions | |
fixKeyConflicts (array $fields, array $context) | |
Rename any context field that would otherwise overwrite a message key. More... | |
formatMonologV0 (array $record) | |
Borrowed from monolog/monolog 1.25.3 https://github.com/Seldaek/monolog/blob/1.x/src/Monolog/Formatter/LogstashFormatter.php#L87-L128. More... | |
formatMonologV1 (array $record) | |
Borrowed mostly from monolog/monolog 1.25.3 https://github.com/Seldaek/monolog/blob/1.25.3/src/Monolog/Formatter/LogstashFormatter.php#L130-165. More... | |
formatV0 (array $record) | |
Prevent key conflicts. More... | |
formatV1 (array $record) | |
Prevent key conflicts. More... | |
normalizeException (\Throwable $e, int $depth=0) | |
Use a more user-friendly trace format than Monolog\Formatter\NormalizerFormatter. More... | |
Protected Attributes | |
array | $reservedKeys |
Keys which should not be used in log context. More... | |
int | $version |
Logstash format version to use. More... | |
LogstashFormatter squashes the base message array and the context and extras subarrays into one.
This can result in unfortunately named context fields overwriting other data (T145133). This class modifies the standard LogstashFormatter to rename such fields and flag the message. Also changes exception JSON-ification which is done poorly by the standard class.
Definition at line 13 of file LogstashFormatter.php.
MediaWiki\Logger\Monolog\LogstashFormatter::__construct | ( | string | $applicationName, |
?string | $systemName = null , |
||
string | $extraKey = '' , |
||
string | $contextKey = 'ctxt_' , |
||
$version = self::V0 |
|||
) |
TODO: See T247675 for removing this override.
string | $applicationName | The application that sends the data, used as the "type" field of logstash |
string | null | $systemName | The system/machine name, used as the "source" field of logstash, defaults to the hostname of the machine |
string | $extraKey | The key for extra keys inside logstash "fields", defaults to '' |
string | $contextKey | The key for context keys inside logstash "fields", defaults |
int | $version | The logstash format version to use, defaults to V0 to '' |
Definition at line 47 of file LogstashFormatter.php.
References MediaWiki\Logger\Monolog\LogstashFormatter\$version.
|
protected |
Rename any context field that would otherwise overwrite a message key.
array | $fields | Fields to be sent to logstash |
array | $context | Copy of the original $record['context'] |
Definition at line 207 of file LogstashFormatter.php.
MediaWiki\Logger\Monolog\LogstashFormatter::format | ( | array | $record | ) |
Reimplemented in MediaWiki\Logger\Monolog\CeeFormatter.
Definition at line 54 of file LogstashFormatter.php.
References MediaWiki\Logger\Monolog\LogstashFormatter\formatV1().
|
protected |
Borrowed from monolog/monolog 1.25.3 https://github.com/Seldaek/monolog/blob/1.x/src/Monolog/Formatter/LogstashFormatter.php#L87-L128.
array | $record |
Definition at line 93 of file LogstashFormatter.php.
|
protected |
Borrowed mostly from monolog/monolog 1.25.3 https://github.com/Seldaek/monolog/blob/1.25.3/src/Monolog/Formatter/LogstashFormatter.php#L130-165.
array | $record |
Definition at line 159 of file LogstashFormatter.php.
|
protected |
Prevent key conflicts.
array | $record |
Definition at line 72 of file LogstashFormatter.php.
|
protected |
Prevent key conflicts.
array | $record |
Definition at line 140 of file LogstashFormatter.php.
Referenced by MediaWiki\Logger\Monolog\LogstashFormatter\format().
|
protected |
Use a more user-friendly trace format than Monolog\Formatter\NormalizerFormatter.
\\Throwable | $e | |
int | $depth |
Definition at line 228 of file LogstashFormatter.php.
References MWExceptionHandler\getRedactedTraceAsString().
|
protected |
Keys which should not be used in log context.
Definition at line 19 of file LogstashFormatter.php.
|
protected |
Logstash format version to use.
Definition at line 33 of file LogstashFormatter.php.
Referenced by MediaWiki\Logger\Monolog\LogstashFormatter\__construct().
const MediaWiki\Logger\Monolog\LogstashFormatter::V0 = 0 |
Definition at line 15 of file LogstashFormatter.php.
const MediaWiki\Logger\Monolog\LogstashFormatter::V1 = 1 |
Definition at line 16 of file LogstashFormatter.php.