[riot-notifications] [RIOT-OS/RIOT] Add basic syslog implementation (#11362)

crest42 notifications at github.com
Tue Apr 9 17:05:11 CEST 2019

### Contribution description
For a university project, I added a small and lightweight syslog implementation for RIOT. The implementation included in this pull request is a working prototype with a few features missing (see below). I added this pull request to get a general review if this feature is desired by the RIOT community and if so, to get feedback about the design of my implementation.

@miri64 You mentioned interest in such an implementation in #2376 back in 2016. I hope this is still relevant :)

The implementation consists of two parts:

1. The user interface

   This Interface is inspired by the glibc implementation of syslog 
   (https://www.gnu.org/software/libc/manual/html_node/Overview-of-Syslog.html) and should enable a user to easily commit messages to a local syslogd instance using generic RIOT IPC.

   The implementation is really simple. When a user logs a string, a syslog msg is built and wrapped into a syslog_msg_t. A pointer to this msg is transferred via RIOT IPC.

   Missing Features: 
   - vsyslog
   - setlogmask
   - closelog
   - The syslog facility is global for all logging entities ATM. This needs a little bit of rework
   - Documentation

2. The syslogd implementation

   To get a lightweight implementation that is easily extensible with RIOT IPC and that uses no async I/O and stuff like that, I wrote a very basic implementation of a syslogd, which works on a single input and multiplexes syslog messages on this input to multiple outputs. To not blew up the RIOT codebase i implemented this syslogd as a pkg.

   Missing Features:
   - Outputs are very basic by now 
   - Documentation
   - syslog.conf support
   - Network Input

   Supported Features:
   - Logging to stdout
   - Logging to a remote syslog server (tested with a local installation of syslog-ng)
   - Logging to file (Test still missing)
   - The implementation should be rfc5424 compatible

### Testing procedure

Atm only native is tested. I plan to make a further test with a nucleo-f767zi in the future.

1. cd tests/syslog
2. Update the ipv6 address of the remote logging target if remote logging is needed
3. make all term
4. syslog_init
5. syslog "msg" or syslog_test

Expected Output:
> syslog_init
> syslog "msg"
syslog "msg"
<8> 1 - barkon.chilio.net test 0 0 msg
> syslog_test
<11> 1 - example.com test 0 0 Logging Logging 123 3
<14> 1 - example.com test 0 0 Logging Logging 123 6
<8> 1 - example.com test 0 0 TestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTest
<8> 1 - example.com test 0 0 
<9> 1 - example.com test 0 0 
<10> 1 - example.com test 0 0 
<11> 1 - example.com test 0 0 
<12> 1 - example.com test 0 0 
<13> 1 - example.com test 0 0 
<14> 1 - example.com test 0 0 

### Issues/PRs references
resolve #2376.

You can view, comment on, or merge this pull request online at:


-- Commit Summary --

  * lsyslogd_pkg: add initial lsyslogd pkg files
  * sys/syslog: Add syslog implementation (inspired by glibc implementation)
  * sys/syslog: Add lsyslogd input for RIOT IPC
  * sys/syslog: Add shell commands wrapper for syslog
  * sys/syslog: Add tests for syslog implementation

-- File Changes --

    A pkg/lsyslogd/Makefile (16)
    A pkg/lsyslogd/Makefile.include (1)
    A pkg/lsyslogd/Makefile.lsyslogd (3)
    A sys/include/syslog/syslog.h (59)
    M sys/shell/commands/Makefile (6)
    M sys/shell/commands/shell_commands.c (9)
    A sys/shell/commands/syslog.c (37)
    A sys/syslog/Makefile (1)
    A sys/syslog/lsyslogd_riot_ipc_input.c (51)
    A sys/syslog/syslog.c (80)
    A tests/syslog/Makefile (25)
    A tests/syslog/main.c (42)

-- Patch Links --


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190409/61746148/attachment.html>

More information about the notifications mailing list