Syslog integration

Would it be possible to have the DVR server use something like log/syslog, google/logger or a similar package to bring syslog logging to the DVR server?

While the current method of just using a single log file is OK, using a system's native facility like syslog would bring some much desired additional features, such as:

  • log file rotation
  • sending logs to a remote/central syslog server
  • systemd-journald integration for systemd–based systems

Can't you pipe the output to a syslogger?

Yes, but that makes for rather unruly logs, as Channels prepends its output with the date/time. Piping the output through sed first fixed that issue, but the different levels of logging aren't identified.

I could play with it a bit more to massage the logs, but there still remains the issue of the log display in the web UI. To keep the ability to view the log in the web UI and use a syslog facility, you'd have to tee the output to the log file and syslog, thus not really fixing the issue with rotating the log and other situations that syslog is meant to fix.

There's no concept of log levels in the DVR, so that's probably the best you can get.

Yes, we need the local log file to display on web UI and for submitting diagnostics. I'm not sure how that would work if we started sending logs directly to syslog.

By querying the system's log for the information.

I understand that it would require some refactoring how the logging facilities are handled internally, and that it's not a simple drop-in change to be made. But perhaps it's something that could be investigated for a future release.

(Syslog is a pretty standard system, and even the newer replacements—rsyslogd, ng-syslog, journald, etc.—all understand the same input format.)

I had played with this in the past, including mucking about with different StandardOutput and StandardError settings in the service unit, and couldn't come up with a satisfactory result. Perhaps I'll tackle again.

Perhaps changing the ExecStart around, perhaps like:

ExecStart=/usr/lib/channels-dvr/latest/channels-dvr 2>&1 | tee -a /var/lib/channels-dvr/channels-dvr.log | sed 's/^.*\[/\[/' | systemd-cat -t channels-dvr

I guess I have something new to experiment with this weekend.