JetBrains / ideolog

Interactive viewer for '.log' files.
MIT License
254 stars 55 forks source link

Ideolog doesn't recognize log format with custom regex in PhpStorm #68

Closed Vorta closed 7 months ago

Vorta commented 5 years ago

I'm trying to add a Symfony Monolog formatter but Ideolog doesn't seem to work.

Version: 192.0.12.0

Message pattern: ^\[(.*)\]\s([\w-\s]+)\.(\w+):\s([^\[\{]+)\s([\[\{].*[\]\}])\s([\[\{].*[\]\}])$ Message start pattern: ^\[ Time format: yyyy-MM-dd HH:mm:ss Time capture group: 1 Severity capture group: 3 Category capture group: 2

"Apply message pattern to all message lines" unchecked

Sample log:

[2019-07-29 15:47:53] request.INFO: Matched route "my_route_name". {"route":"my_route_name","route_parameters":{"_route":"my_route_name","_controller":"My\\Sample\\Project\\Namespace","command":"verify-email"},"request_uri":"http://test-url","method":"GET"} []
[2019-07-29 15:47:53] security.DEBUG: Checking for guard authentication credentials. {"firewall_key":"api","authenticators":1} []
[2019-07-29 15:47:53] security.DEBUG: Checking support on guard authenticator. {"firewall_key":"api","authenticator":"My\\Sample\\Project\\Namespace"} []
[2019-07-29 15:47:53] security.DEBUG: Guard authenticator does not support the request. {"firewall_key":"api","authenticator":"My\\Sample\\Project\\Namespace"} []
[2019-07-29 15:47:53] security.INFO: Populated the TokenStorage with an anonymous Token. [] []

Ideolog says: Log format not recognized

nickvergessen commented 4 years ago

I have a similar with Nextclouds JSON log

Message pattern:

^\{"reqId":\"[^\"]*\",\"level\"\:(\d+)\,\"time\"\:\"([^\"]*)\"\,\"remoteAddr\"\:\"[^\"]*\",\"user\":\"[^\"]*\",\"app\":\"([^\"]*)\",\"method\"\:\"[^\"]*\",\"url\"\:\"[^\"]*\",\"message\"\:\"((?:[^"\\]|\\.)*)\",\"userAgent\":\"[^\"]*\",\"version\":\"[^\"]*\"\}$

Message start pattern: ^\{ Time format: HH:mm:ss Time capture group: 2 Severity capture group: 0 Category capture group (app): 1

Actual message capture group: 3

Sample log:

{"reqId":"y2spiWKKedYotaRJfEKT","level":2,"time":"2019-09-17T17:49:22+02:00","remoteAddr":"127.0.0.1","user":"--","app":"OC\\Log\\Rotate","method":"GET","url":"\/cron.php","message":"Log file \"\/home\/nickv\/Nextcloud\/18\/server\/config\/nickv.nextcloud.log\" was over 52428 bytes, moved to \"\/home\/nickv\/Nextcloud\/18\/server\/config\/nickv.nextcloud.log.1\"","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:69.0) Gecko\/20100101 Firefox\/69.0","version":"18.0.0.0"}

If I enable it, the warning that no rule matches is gone, but the log is not colored anymore and I actually can't see anything useful from the plugin anymore?

Bildschirmfoto von 2019-09-18 12-32-37

ghost commented 4 years ago

I'm having same troubles with my own logs format...

I don't know if someone get a soluce so I post my conf here.

After all, here a simple line from my log file : 2020-05-31T10:42:58 routing.INFO: Request handled correctly! [] []

I use monolog to generate this kind of log with these options:

$dateFormat = "Y-m-d\TH:i:s";
$output = "%datetime% %channel%.%level_name%: %message% %context% %extra%\n";
$formater = new LineFormatter($output, $dateFormat);

And so, this is my ideolog log format configuration:

Did I misspelled some Regex?

Edit: I also tried ^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}) (\w).(\w): (.*) as message pattern, but even after close log file and open it again, it doesn't change.

ArtemKar123 commented 7 months ago

Fixed in #165. Will be released in the next version. Thanks for your feedback!