Skip to content

Commit 3faa89d

Browse files
authored
Merge pull request #1 from markusa380/monolog-loki-exp
Monolog Loki Logging
2 parents f9a6955 + 56901b1 commit 3faa89d

File tree

3 files changed

+52
-3
lines changed

3 files changed

+52
-3
lines changed

docker-compose.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ services:
44
networks:
55
- servernet
66
- internal
7+
- monitor-net
78
depends_on:
89
- database
910
volumes:
@@ -57,6 +58,8 @@ networks:
5758
driver: overlay
5859
servernet:
5960
external: true
61+
monitor-net:
62+
external: true
6063

6164
secrets:
6265
# AWS credentials file for a user with s3:PutObject permission

mediawiki/LocalSettings.php

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,56 @@
11
<?php
2-
# See https://www.mediawiki.org/wiki/Manual:Configuration_settings
2+
ini_set( 'display_errors', 1 );
3+
ini_set( 'display_startup_errors', 1 );
4+
ini_set( 'log_errors', 'On' );
5+
ini_set( 'error_log', '/dev/stderr' );
6+
7+
error_reporting( -1 );
8+
# https://www.mediawiki.org/wiki/Manual:Configuration_settings
39

410
# Protect against web entry
511
if ( !defined( 'MEDIAWIKI' ) ) {
612
exit;
713
}
814

15+
$wgMWLoggerDefaultSpi = [
16+
'class' => '\\MediaWiki\\Logger\\MonologSpi',
17+
'args' => [ [
18+
'loggers' => [
19+
'@default' => [
20+
'processors' => [ 'wiki', 'psr' ],
21+
'handlers' => [ 'loki' ]
22+
],
23+
'rdbms' => [],
24+
'objectcache' => [],
25+
'SQLBagOStuff' => []
26+
],
27+
'processors' => [
28+
'wiki' => [ 'class' => '\\MediaWiki\\Logger\\Monolog\\WikiProcessor' ],
29+
'psr' => [ 'class' => '\\Monolog\\Processor\\PsrLogMessageProcessor' ],
30+
],
31+
'handlers' => [
32+
'loki' => [
33+
'class' => \Itspire\MonologLoki\Handler\LokiHandler::class,
34+
'args' => [ [
35+
'entrypoint' => 'http://loki:3100',
36+
'context' => [],
37+
'labels' => [
38+
'app' => 'nv-wiki'
39+
],
40+
'client_name' => 'nv-wiki',
41+
] ],
42+
'formatter' => 'lokif'
43+
],
44+
],
45+
'formatters' => [
46+
'lokif' => [ 'class' => \Itspire\MonologLoki\Formatter\LokiFormatter::class ]
47+
]
48+
] ]
49+
];
50+
51+
## Uncomment this to disable output compression
52+
# $wgDisableOutputCompression = true;
53+
954
$wgSitename = "Night Vision Wiki";
1055
$wgMetaNamespace = "Project";
1156

@@ -17,7 +62,7 @@
1762
$wgScriptPath = "";
1863

1964
## The protocol and server name to use in fully-qualified URLs
20-
# $wgServer = "http://192.168.0.159:8082";
65+
# $wgServer = "http://192.168.0.159:8080";
2166
$wgServer = "https://nv-intl.com";
2267

2368
## The URL path to static resources (images, scripts, etc.)

mediawiki/composer.local.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"x-mediawiki/pluggableauth": "1",
1111
"x-mediawiki/templatestyles": "2",
1212
"x-mediawiki/uploadwizard": "2",
13-
"x-mediawiki/wsoauth": "1"
13+
"x-mediawiki/wsoauth": "1",
14+
"itspire/monolog-loki": "1.3.0"
1415
},
1516
"repositories": [
1617
{

0 commit comments

Comments
 (0)