Debug Node output to Logagent or Logstash

Can anyone point me in the right direction here - I would like to write some debug and monitoring messages to an external log collection tool (Sematext through their Logagent shipper) and have got a bit confused. There are a few projects doing similar stuff but from what I have found what I am after.

Writing logs to Logagent is pretty straightforward - a PUT or a POST or many other possibilities - but how to get the debug node to do this?

Easiest would be to create your own custom log handler https://nodered.org/docs/user-guide/runtime/logging

1 Like

Thanks - I saw that, is there some more detailed instructions about how to get started with this?

Specific questions:

How best do you debug custom logger code? I added that code to my settings.js, restarted Node Red and ... nothing. It seems if I have an error in the code Node Red won't start, if I remove it then Node Red starts again. But I see no output to say where the error may be.

Then once I get the logger integrated how do I use it? Does it show as a node or is it another output destination offered to all debug nodes?

Hello everyone - can anyone help me with these two specific questions? I am struggling to make progress.

How best do you debug custom logger code? I added that code to my settings.js, restarted Node Red and ... nothing. It seems if I have an error in the code Node Red won't start, if I remove it then Node Red starts again. But I see no output to say where the error may be.

Then once I get the logger integrated how do I use it? Does it show as a node or is it another output destination offered to all debug nodes?

Thanks in advance.

generally it means that the file is no longer valid js so usually a good linter will highlight the error that stops it starting.

Once running it runs in parallel with other loggers (unless you turn them off) so any write to log will call your code.

Many thanks for the hints, unfortunately this turned out to be too time-consuming so I gave up with this approach and instead captured the output from the Docker containers and spooled them to Sematext throught a Logagent container. Anyone who is interested can see the containers in my Github.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.