[systemd-devel] right way to log to rsyslog/syslog only?
"Jóhann B. Guðmundsson"
johannbg at gmail.com
Thu Aug 7 11:11:39 PDT 2014
On 08/07/2014 04:12 PM, Leonid Isaev wrote:
>> >Perhaps understanding why you're allergic to the journal would help in
>> >figuring out solutions to the actual underlying problem.
> There is nothing wrong with the journald per se, but it's not a replacement for
> the classic syslog
Yes it is.
And there is a very much difference in using one of the traditional
message printing APIs like syslog for logging as in doing this
#include <syslog.h>
int main(int argc, char *argv[])
{ syslog(LOG_NOTICE, "Hello World");
return 0;
}
Vs using the journal's native APIs as in this.
#include <systemd/sd-journal.h>
int main(int argc, char *argv[])
{ sd_journal_print(LOG_NOTICE, "Hello World");
return 0;
}
Arguably one of journals major/only shortcoming compared to what's out
there is it's lack the ability to send syslog messages over the syslog
network protocol but I think it's just a matter of time until it does,
since it's arguably unavoidable ( think for example containers here and
I would be amazed if submitted patches would be rejected that would add
that )
But I guess you can hack yourself around that shortcoming by turning off
persistent storage ( that is if you dont want to store logs as well on
the host ) and run something like
journalctl -o short -f | nc <ip> -u 514 -w 1
that avoids the problem having two "loggers" running on the same host (
like using syslog-ng or rsyslog alongside journal ) to solve that
particular problem.
JBG
More information about the systemd-devel
mailing list