amir20 / dozzle

Realtime log viewer for docker containers.
https://dozzle.dev/
MIT License
6.06k stars 303 forks source link

Detecting levels in pino JSON output #3341

Open oatymart opened 4 hours ago

oatymart commented 4 hours ago

Describe the feature you would like to see

I have a node app with pino logging to stdout in a container. Dozzle picks up the log stream but can't detect levels based on pino's default numeric output: Screenshot 2024-10-24 at 20 49 25

I used a formatter from pino's docs to replace the number with a string. Dozzle still in the dark about levels: Screenshot 2024-10-24 at 20 49 14

Lastly I edited the formatter to wrap the level as [level]. Now, Dozzle can detect levels: Screenshot 2024-10-24 at 20 48 58

My question is, can anything be done on this side to make Dozzle more pino-aware? (I don't know how it parses the level from the logs, but it doesn't seem like "level": "debug" is that much harder to detect than "level": "[debug]".)

amir20 commented 4 hours ago

@oatymart I think you have a bigger problem. "info" should work, but looking at your screenshot, I see [1] in the beginning of the line. In this case, Dozzle can't parse the JSON, which is why it is not working for you.

Can you remove that? As of now, Dozzle is treating your log as plain text which is why [info] works.