Log Hub Events to remote server (syslog) [redux]

... and for completeness, Push user logs to Syslog server [redux]

I'm sorry to be reviving topics that have been long-ago closed, but sometimes someone comes around wanting to add to the already closed topics. The following are the topics in question, in case anyone wants to review:
Log Hub Events to remote server (syslog)?, Push user logs to Syslog server, and also (discovered while I was preparing to compose this message) Help getting Syslog Device to automatically initialize (to send logging messages) after hub reboot.

With much thanks to @User12Hubitat, @staylorx, the authors of the Syslog.groovy driver, and @jtp10181, who provides some enhancement, I have further modified the driver, and would like to contribute my changes (I'm presuming to @staylorx, whose version appears to be the definitive one for this driver).

In case anyone is curious to know what I've done:

  • I added a configuration option for the log facility for this driver to use. It seems likely to me that some folks might want to specify which log facility to log to on the remote host, in order to more easily redirect the log messages.
  • the log priority is thus calculated from the configured facility and the priority given by the hub.
  • I added @jtp10181's code to strip out HTML escapes from the log messages.
  • borrowing some more from @jtp10181, I adjusted the constructed string to use the device's ID as the process ID.

Enumerated this way, it seems like I barely did anything, but I now have syslogging to a remote server from my Hubitat hub, with the syslog server able to store these in their own file. @staylorx, please feel free to reach out to me if you would like to review my changes, to potentially merge them into your driver.

4 Likes

Hi @TheRockgarden . Thanks for the great additions . I'll reach out and we'll get this sorted.

1 Like

@TheRockgarden where are these changes available?

1 Like

Hi. Sorry for not replying sooner, but I've been away. I have not put my modifications on any "cloud" sites (I do have a github page but pretty much don't actually use it), though I could if you want me to. I would be more inclined to just send you "diff"s of the code changes, though I should probably check first to make sure that I've updated to the latest version of the official driver.

I'd be interested in these as well.

Alright. I'll make sure that I have the latest version of the official driver, and adjust my modifications to that, then take some time to make them available somewhere.

The good news is that the "official" version of the code that I based my updates on hasn't changed since I last obtained a copy, so there was nothing for me to do to ensure that I'm working from the latest version.

Meanwhile, I've taken a fork of that version to my own Github page, then applied my changes to that fork. The resulting driver can now be obtained from https://github.com/syl-robitaille/hubitatSyslog. I hope that folks find this helpful.

2 Likes