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.

3 Likes

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

1 Like