PimpMyLog icon indicating copy to clipboard operation
PimpMyLog copied to clipboard

Add a full-multiline parser

Open potsky opened this issue 10 years ago • 3 comments

Assigned to Suggestions #59. As reported in Tender:

Hi,

i use a php5-fpm server and got different logs. Only error log is detected by default.

4 diffrent logs:
\/var\/log\/php5/access.log - access logs - detailed e.g
03/Dec/2014:23:10:24 +0000 "POST /logs/inc/getlog.pml.php?1417648224400&tz=Europe%2FBerlin&l=en_GB&w=on&o=&p=-1&i=php6&m=10&r=5&s=&n=false" 200 232.509ms 512kb 98.92%
03/Dec/2014:23:10:24 +0000 "POST /logs/inc/getlog.pml.php?1417648224516&tz=Europe%2FBerlin&l=en_GB&w=on&o=&p=-1&i=php6&m=10&r=5&s=&n=false" 200 234.486ms 512kb 98.09%
03/Dec/2014:23:10:29 +0000 "POST /logs/inc/getlog.pml.php?1417648229696&tz=Europe%2FBerlin&l=en_GB&w=on&o=&p=-1&i=php6&m=10&r=5&s=&n=false" 200 11.949ms 512kb 167.38%

\/var\/log\/php5-fpm.log - Problems of php5-fpm
[03-Dec-2014 22:49:10] WARNING: [pool vagrant] child 9756, script '/usr/share/php/PimpMyLog/inc/upgrade.pml.php' (request: "POST /logs/inc/upgrade.pml.php") executing too slow (5.519936 sec), logging
[03-Dec-2014 22:49:10] NOTICE: child 9756 stopped for tracing
[03-Dec-2014 22:49:10] NOTICE: about to trace 9756
[03-Dec-2014 22:49:10] NOTICE: finished trace of 9756

\/var\/log\/php5\/error.log - PHP errors
[04-Dec-2014 00:04:29 Europe/Berlin] PHP Warning: fopen(/var/log/php5/access.log): failed to open stream: Permission denied in /usr/share/php/PimpMyLog/inc/classes/LogParser.php on line 30

\/var\/log\/php5\/slow.log - Slow PHP Scripts
[03-Dec-2014 23:31:23] [pool vagrant] pid 21146
script_filename = /usr/share/php/PimpMyLog/inc/upgrade.pml.php
[0x00007f5a257012a8] file_get_contents() /usr/share/php/PimpMyLog/inc/upgrade.pml.php:111

thx for the composer path fix!

all the best
xfi

potsky avatar Dec 05 '14 10:12 potsky

Now:

"apache1": {
    "display" : "Apache Error #1",
    "path"    : "\/var\/log\/apache2\/error.log",
    "refresh" : 5,
    "max"     : 10,
    "notify"  : true,
    "format"  : {
        "type"         : "HTTPD 2.2",
        "regex"        : "|^\\[(.*)\\] \\[(.*)\\] (\\[client (.*)\\] )*((?!\\[client ).*)(, referer: (.*))*$|U",
        "export_title" : "Log",
        "match"        : {
            "Date"     : 1,
            "IP"       : 4,
            "Log"      : 5,
            "Severity" : 2,
            "Referer"  : 7
        },
        "types": {
            "Date"     : "date:H:i:s",
            "IP"       : "ip:http",
            "Log"      : "pre",
            "Severity" : "badge:severity",
            "Referer"  : "link"
        },
        "exclude": {
            "Log": ["\/PHP Stack trace:\/", "\/PHP *[0-9]*\\. \/"]
        }
    }
}

In 1.9 :

"apache1": {
    "display" : "Apache Error #1",
    "path"    : "\/var\/log\/apache2\/error.log",
    "refresh" : 5,
    "max"     : 10,
    "notify"  : true,
    "format"  : {
        "type"         : "HTTPD 2.2",
        "regex"        : [
            "|^\\[(.*)\\] \\[(.*)\\] (\\[client (.*)\\] )*((?!\\[client ).*)(, referer: (.*))*$|U",
            "|^\\[(.*)\\] \\[(.*)\\] (\\[client (.*)\\] )*((?!\\[client ).*)(, referer: (.*))*$|U",
        ],
        "export_title" : "Log",
        "match"        : {
            "Date"            : 1,
            "IP"              : 4,
            "Log"             : 5,
            "Severity"        : 2,
            "Referer"         : 7,
            "Date2ndLine"     : [2,1],
            "IP2ndLine"       : [2,4],
            "Log2ndLine"      : [2,5],
            "Severity2ndLine" : [2,2],
            "Referer2ndLine"  : [2,7]
        },
        "types": {
            "Date"            : "date:H:i:s",
            "IP"              : "ip:http",
            "Log"             : "pre",
            "Severity"        : "badge:severity",
            "Referer"         : "link",
            "Date2ndLine"     : "date:H:i:s",
            "IP2ndLine"       : "ip:http",
            "Log2ndLine"      : "pre",
            "Severity2ndLine" : "badge:severity",
            "Referer2ndLine"  : "link"
        },
        "exclude": {
            "Log"        : ["\/PHP Stack trace:\/", "\/PHP *[0-9]*\\. \/"]
            "Log2ndLine" : ["\/PHP Stack trace:\/", "\/PHP *[0-9]*\\. \/"]
        }
    }
}

potsky avatar Dec 05 '14 10:12 potsky

cool :+1:

xf- avatar Dec 05 '14 12:12 xf-

Really looking forward to it!

deadbead avatar Dec 29 '14 08:12 deadbead