OpenMQTTGateway icon indicating copy to clipboard operation
OpenMQTTGateway copied to clipboard

Feature syslog option

Open michapr opened this issue 5 years ago • 18 comments

What do you think about the option to add the syslog.h to the project?

In such a case you could debug the device if it is not more connected via serial. Updating via OTA is working fine - a log via network could be helpful.

I have added it in most of my projects and think it is useful.

Thanks! Michael

michapr avatar Aug 16 '20 18:08 michapr

You mean this library? https://github.com/arcao/Syslog

1technophile avatar Aug 16 '20 18:08 1technophile

yes, this one. sorry,... forgot the link ;)

michapr avatar Aug 17 '20 05:08 michapr

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 17 '20 20:10 stale[bot]

I really still think it would be a good idea to have this syslog feature. If enabled then send the same information additional to syslog server with same level.

In this time I add it after every update the needed output lines... But I think it can be done by a new function, maybe.

Thanks

michapr avatar Oct 18 '20 07:10 michapr

In many of my projects, I've been using a ESP-01 (ESP8266) with some code to send Syslog messages. Connected the TX pin on the ESP32 to the RX of the ESP-01. ESP-01's job is only to send any and all text it receives over the serial port from the ESP32 to a syslog server.

DavidStacer avatar Dec 28 '20 19:12 DavidStacer

It's not big deal to add it (technical) - it is working, if define extra places with extra lines (code) for syslog output. (I use it in my BLE gateways)

But I had no idea how to solve it "elegantly" with a function, so that syslog can use the same procedure as standard logging.

michapr avatar Jan 08 '21 16:01 michapr

But I had no idea how to solve it "elegantly" with a function, so that syslog can use the same procedure as standard logging.

Should maybe implemented at ArduinoLog level ?

1technophile avatar Jan 26 '21 22:01 1technophile

This feature is very useful to collect all logs in one place

Nikolay-Ch avatar Aug 19 '21 13:08 Nikolay-Ch

A similar idea that could be used more directly with arduinolog would be a telnet server. This is what I use to monitor the logs of my devices when not connected with serial port.

h2zero avatar Aug 19 '21 15:08 h2zero

A similar idea that could be used more directly with arduinolog would be a telnet server. This is what I use to monitor the logs of my devices when not connected with serial port.

Hm.... In my own network, I use FluentD to collect all logs (from switches, firewalls, and other devices) in one location... So, it is useful to use one service to collect all logs... And also SysLog format is standard, so it can be used with different log-collectors in different OSs (windows, linux etc)...

Nikolay-Ch avatar Aug 19 '21 15:08 Nikolay-Ch

I also want syslog capability, I use syslogging for all my iot devices, tasmota has it build in, and I add it to all my projects. I have not looked at tasmotas impelmentation, but I use streamutils and arcao/Syslog.

Is there any way to make plugins for this, or any existing logging mechanism to hook into ? I will take a look and see if there is an easy way to code it in, or a PR to expose existing logging.

If not I can insert streamutils and redirect the serial stream if its harcoded.

EDIT: oops I misunderstood, that arduinolog is the existing implementation, that makes it easier I think, should be able to just add syslog and add a log stream variable in user_config to replace &serial in main.ino

tablatronix avatar Sep 19 '21 16:09 tablatronix

any progress here? Would be really nice to have this option to check the configured messages wireless on syslog server...

michapr avatar Dec 15 '22 12:12 michapr

This would be useful to notice any errors and such

Did someone have code based on ArduinoLog?

EDIT: WebSerial in this project implementation should serve as good basis for syslog ArduinoLog output as well

ssalonen avatar Mar 05 '24 05:03 ssalonen

Further comment

I found this library https://github.com/dirkx/tee-log that would make the implementation rather straightforward

It basically implements the Print interface, and therefore is pluggable with ArduinoLog used by openmqttgateway.

Tee-log logs to both syslog and optionally also to serial. Only caveat seems to be the fact that it is hardcoded to use wireless network interface (WifiUdp)...probably not a large effort to upstream/fork ethernet support

Integration would then basically consist of introducing configuration parameters for the

  1. syslog destination ip and port config parameters. Syslog identifier could be the hostname of the device
  2. Flag to enable/disable syslogging functionality. If enabled, instead logging to Serial, we would use SyslogStream from tee-log instead.

@tablatronix did you work on this already or plan to work on it?

ssalonen avatar Mar 05 '24 17:03 ssalonen

I have an implementation I use in my own libs that works. I use a redirector similar to tee and a syslog library. I can see if I can bring it over in a fork or plugin

tablatronix avatar Mar 06 '24 00:03 tablatronix

I am using

/**
 * Local logging solutions, using steamutils and syslog
 * StreamUtils
 * https://github.com/Chris--A/PrintEx
 * Allows for stream buffering, redirection, mirroring etc.
 *
 * syslog
 * https://github.com/arcao/Syslog.git
 * An Arduino library for logging to Syslog server via `UDP` protocol in 
 * [IETF (RFC 5424)] and [BSD (RFC 3164)] message format
 */

I really need to see what tasmota is using, they probably rolled their own minimal version that might be better suited.

tablatronix avatar Mar 06 '24 03:03 tablatronix