Michał Leśniewski's PicoSysLog Makes Remote Logging of Espressif ESP8266, ESP32 Projects a Breeze

Still printing your logs to the serial port? Throw them at a remote syslog server automatically at the same time!

Gareth Halfacree
1 month agoProductivity / Debugging

Developer Michał Leśniewski has released a logging library that allows Espressif ESP8266 and ESP32 projects to send their logs to a syslog server for capture and analysis — and using it is as simple as swapping out your Serial commands.

"I built PicoSyslog, a lightweight logging library for ESP8266 & ESP32 that sends logs to a Linux syslog server," Leśniewski explains of the tool. "It works as a drop-in replacement for Serial, so you can log messages just like you normally would, but now they’re written to serial and sent over the network too!"

Traditionally, logging on microcontrollers has been a somewhat ephemeral thing — outputting status strings to the serial connection and hoping there's something paying attention on the other end. Some projects may require more permanent logging, which typically involves writing to a flash device or EPROM — but then those logs have to be manually retrieved.

PicoSysLog, by contrast, sends log messages out over a network connection — targeting a remote server running a syslog daemon. "If you're already running a Linux server," Leśniewski notes, "it's probably already running a syslog server that you can use. If you want a dedicated syslog server, you can spin one up easily using Docker."

Configuring the library is as simple as adding the IP address of your preferred syslog server, after which instructions like Serial.write, Serial.writeln, and Serial.printf can be swapped out for syslog.write, syslog.writeln, and syslog.printf — which send the messages to the remote server, with optional priority levels attached, and still prints them to the serial port too.

Leśniewski has released the PicoSysLog library on GitHub under the GNU Lesser General Public License 3; more information, including some comments about how the code could be improved, is available on Reddit.

Gareth Halfacree
Freelance journalist, technical author, hacker, tinkerer, erstwhile sysadmin. For hire: freelance@halfacree.co.uk.
Latest articles
Sponsored articles
Related articles
Get our weekly newsletter when you join Hackster.
Latest articles
Read more
Related articles