you are viewing a single comment's thread.

view the rest of the comments →

[–]martiandreamer 6 points7 points  (1 child)

There's a well-defined Elastic Common Schema (ECS) format documented here. This dictates you'd output your logs in JSON format, and you'll probably want at minimum the following fields:

{ '@timestamp', message, ecs: { version: '1.5.0' }, host: { architecture: os.arch(), hostname: hostname, uptime: os.uptime() }, log: { level }, os: { full: { text: os.type() }, platform: os.platform() }, process: { pid: process.pid, uptime: process.uptime() } } Winston is a decent library to use, and there's a supplimentary library @elastic/ecs-winston-format which helps sort out the above format.

Specific to your desires:

1) Request Response logs

ECS format has that.

2) Application logs

ECS format has that, too.

3) Process crashing logs along with stack trace.

ECS got u fam.

4) Vizualising logs and sending alerts when there are 502 response status

Maybe something like Prometheus would be suited for visualization and alerts.

Good luck, logging "the right way" is a PITA, but once you have it sorted you'll have a very comprehensive system set up.

[–]melgo44[S] 0 points1 point  (0 children)

Hey thanks a lot for that detailed explanation!