Am 03.07.2015 um 17:09 schrieb Marcin Niesluchowski:
This interface can be improved. Should be easy.Why can't you just make sure that your target has a working* Message credibility: Lets imagine simple service which collects logs via unix sockets. There is no reliable way of identifying logging process. getsockopt() with SO_PEERCRED
syslogd/rsyslogd/journald/whatever?
All can be done perfectly fine in userspace.
option would give pid form cred structure, but according to manual it may not be of actual logging process:
"The returned credentials are those that were in effect at the time of the call to connect(2) or socketpair(2)."
- select(7)
* Early userspace tool: Helpful especially for embeded systems.This is what we do already. In early user space spawn your logger as early as possible.
"embedded Linux is special" is not an excuse btw. ;)
* Reliability: Userspace service may be killed due to out of memory (OOM). This is kernel cyclic buffer, which size can be specified differently according to situation.This is what we have /proc/<pid>/oom_adj and /proc/<pid>/oom_score_adj for.
* Possibility of using it with pstore: This code could be extended to log additional buffers to persistent storage same way main (kmsg) log buffer is.pstorefs and friends?
* Use case of attaching file descriptor to stdout/stderr: Especially in early userspace.You can redirect these also in userspace.
* Performance: Those services mentioned by You are weeker solutions in that case. Especially systemd-journald is much too heavy soulution.Do you have numbers? I agree systemd-journald is heavy wight. But it is by far not the only logging daemon we have...