flowfuse icon indicating copy to clipboard operation
flowfuse copied to clipboard

Preserve x lines of Node-RED log after a crash

Open hardillb opened this issue 2 years ago • 6 comments

Description

The flowforge-nr-launcher will restart Node-RED if it crashes, but it is possible for the reason for the crash to be lost as it only holds the last 1000 lines.

If the flow has debug nodes set to print to console it is easy to cause the logs to roll over before the crash can be investigated.

It would be useful to store the end of the log at the point of the crash to allow debugging.

hardillb avatar Oct 13 '22 08:10 hardillb

Other than logs, is it possible to capture part of stderr from the Node-RED process? Meaning, not only stdout.

ZJvandeWeg avatar Oct 13 '22 08:10 ZJvandeWeg

Both stderr and stdout are captured in the logs feed

hardillb avatar Oct 13 '22 08:10 hardillb

We don't currently store project logs in any persistent format - they only reside in memory within the launcher. (Log retention period could become a value-add feature)

Whenever the launcher restarts NR it could push the current log buffer to one side, and then provide an API for the platform to get ahold of - rather than it being part of the 'live' logs.

In the UI we could then show a health view of some sort that indicates uptime and when restarts last happened. Clicking on a restart then gets you the last N lines of log output from that run.

I think there are three parts to this:

  • [ ] Launcher keeps in-memory logs for the last N-crashes
  • [ ] Launcher provides API to query uptime/restart/health history
  • [ ] Laucnher provide API to retrieve logs for a given restart event
  • [ ] Add some sort of health view - this needs some UX design work

knolleary avatar Oct 20 '22 16:10 knolleary

Is this still valid @knolleary?

joepavitt avatar May 03 '24 15:05 joepavitt

I don't think we've done anything around this area that changes the situation, but nor has it really come up as a problem to solve.

There is the general observability area where I want to capture ideas of things to improve. I think this would fall into that category (particularly some of my last comments around reporting on crashes).

Suggest we keep this open for now.

knolleary avatar May 03 '24 15:05 knolleary

Thanks Nick, have added it to the "Observability" area in the "Product" project in that case

joepavitt avatar May 03 '24 15:05 joepavitt