[PATCH] Bugfix: svlogd does not apply pattern match options when using timestamps

Denys Vlasenko vda.linux at googlemail.com
Thu Nov 1 13:54:02 UTC 2018


Applied, thanks!
On Thu, Nov 1, 2018 at 4:14 AM Anuj Patel <anuj.patel at meraki.net> wrote:
>
> Svlogd reads an optional config file that can be used to select/deselect patterns when logging. This feature was not working when using the timestamping option as well (svlogd -tt LOGDIR). Svlogd was including the timestamp when trying to apply pattern matches. According to the svlogd docs, http://smarden.org/runit/svlogd.8.html, timestamps should not be considered part of the log message.
>
> The cause of the issue was that "line" in the code was referring to a global buffer of the log data. When timestamping was enabled we would push an additional 26 bytes of timestamp data to the front of the buffer and increment the lineptr pointer in main by 26 bytes. However we don't use lineptr when calling logmatch. Instead we use the global "line" variable which points to the beginning of the buffer with a timestamp.
>
> This fixes the problem by passing the lineptr and linelen values from main directly into logmatch rather than relying on the global "line" pointer which does not get updated when we prepend the timestamp to the log message.
>
> I've tested the change with and without timestamping (-tt) to confirm it works in both cases on Ubuntu 16.04 and some embedded platforms I work on. Any feedback is appreciated!
>
> Thanks,
> Anuj Patel
>
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox


More information about the busybox mailing list