[LEDE-DEV] [PATCH ubox v2] Add template support to logread
Henry Chang
mr.changyuheng at gmail.com
Fri Apr 28 14:14:57 PDT 2017
Hi,
Since I got some questions from the subscribers, I'd like to explain
more why I wanted to add this feature to a cutdown logging system logd
instead of using a more comprehensive syslog implementation such as
rsyslog.
1. logd is built-in
logd is a built-in feature of ubox, and ubox is a heart of
OpenWrt/LEDE. If ubox can achieve all the use cases, we should simply
just use it. Use rsyslog instead will create additional footprint in
terms of resource while a lot of features in rsyslog is not going to
be used.
2. rsyslog lacks ring buffer
logd has a very good ring buffer architecture, and it also comes with
a very good client logread. Deal with the log files created by rsyslog
is kind of complex, as you can see some examples here:
https://www.loggly.com/blog/why-journald/
"Simple plain text files also require log rotation to prevent them
from becoming too large. In log rotation, existing log files are
renamed and compressed. Any programs that watch syslog messages for
problems have to deal with this somehow."
3. To make a working and secure remote logging pipeline, what we need
is just logread, stunnel, and a log server. A log server will probably
need some sort of special format in order to do the authentication or
classification. So without template feature in logread, we'll need
another service in between logread and stunnel for just manipulating
every line of the log or we write another logread to achieve this.
While logread already has some sort of object of the log, doing this
in logread will be easier for both programmers and the computer.
4. The template feature in this patch is very efficient. It doesn't
create any overhead if the user doesn't enable this feature by passing
the corresponding argument. The string replacement is also efficient,
we can improve it by optimizing some strlen() function calls for sure
but basically it's efficient enough.
Regards,
Henry
More information about the Lede-dev
mailing list