2020-05 External logs / syslog feature request

Hi,
first, hope you are all doing well in this Covid Confinement period.

looks like external logs has been requested for years now.

Could you allow a simple way to output logs please? ( something we can optionally enable or disable via a simple management form in "settings", or in an app)

  • Start small and simple if you wish like a simple write to a CSV file on SMB share on the lan with a daily rotation. that should be easy. --> url or IP/shareFolder/, login, password, Filename to simply create filename_[date].csv and a switch to enable or disable

  • You could later add a second option for advanced users: push to a syslog server

CSV would be a very good start ( CSV can even be imported to Splunk or other syslog servers, manually or by monitoring the CSV folder)

Thank you !
Have a nice day !

  • Robert
3 Likes

ws://{your Hub IP}/logsocket

You can then save them raw or parse or... via whatever tool you use for listening to websockets.

The tool I use doesn't save them, but I created a NodeJS tool in 20 mins or so.

That NodeJS tool can be something as simple as this:

const WebSocket = require('ws'); 
const fs = require('fs')

// open socket
const ws = new WebSocket('ws://[hub]/logsocket')

console.log('\r\nListening...')

ws.on('open', function open() {
   // do nothing
})

ws.on('message', function incoming(data) {
   // message received
   console.log(data)
   fs.writeFile('YourFileNameHere', data, (err) => { 
   // In case of a error throw err. 
   if (err) throw err
   })
}

ws.onerror = (error) => {
    console.log(`WebSocket error: ${error}`)
}
2 Likes

There are already 2 web socket, in/out, nodes available

Thanks for that info.
This is very interesting, but not for the regular user.
I will look into WebSockets and try to find a client to install on a server to dump files. Do you have a suggestion of such simple tool to install on a Win 2016 Server or Win 10 desktop ?

This being said, this is way to geeky and lightyears over the head of the regular home user who just want his logs dumped in files.

A simple destination folder on a lan machine to dump csv files is really a much simpler option to consider and would be used by a vaster majority of people who simply want logs not a programming project :wink:

Thanks

Well, the counter to that would be that "regular home user" don't want/need to dump logs en masse at all.

But I have no strong feelings about them adding a new feature to dump logs or not, as long as it is optional.

you are very right for the reguler home user hahaha, let's say the "more hands on user" haha

of course It should be an option that you would need to activate, that's exactly what I also thought when I wrote "and a switch to enable or disable" in the top post

Jason, I added "( something we can optionally enable or disable via a simple management form in "settings", or in an app)" for clarity

No worries! It is a fine, and reasonable, feature request.

I'm not optimistic it will ever make the to-do list since there are workarounds with websocket, but it never hurts to ask for what you want!

NodeRed can be installed on Windows and you can use it to listen to the hub web sockets and write to a file and do a whole lot of other things. Search the community for NodeRed for 1000s of posts on this topic amongst many threads.

1 Like

Could probably do it with splunk, too. I think it has a websocket collector (edit: it does).

1 Like