NethermindEth / nethermind

A robust execution client for Ethereum node operators.
https://nethermind.io/nethermind-client
GNU General Public License v3.0
1.23k stars 428 forks source link

Json log format #6800

Open selfuryon opened 6 months ago

selfuryon commented 6 months ago

Is your feature request related to a problem? Please describe. I'm running Nethermind nodes in Kubernetes. I collect all logs to a central storage and look at all of them via central UI (Loki for example). In that case, it's a standard practice to collect logs in a structured format like JSON. I'd love to have the possibility to change the current log format via some option to JSON.

Describe the solution you'd like Add some option like --log-format where I can specify what type of format I want to have in stdout (like console or json).

Describe alternatives you've considered parse current lines and sometimes join multiple lines together, but it's hard to extract metadata from logs.

Additional context Looks like some work with NLOG.

asdacap commented 6 months ago

Technically, you can modify the NLog.config and have it log to whatever format you want and to wherever. Maybe add a commented out config to achive this?

asdacap commented 6 months ago

I use to dump trace json files which get scraped by elasticsearch on some really hard problem. So the main change is in the NLog.config.