[systemd-devel] why log_set_prohibit_ipc() is set in journald

Nishant Nayan nayan.nishant2000 at gmail.com
Fri Aug 27 12:04:23 UTC 2021


So then where does journald logs its own messages if he wants to?

On Fri, 27 Aug 2021, 13:37 Lennart Poettering, <lennart at poettering.net>
wrote:

> On Fr, 27.08.21 10:01, Mantas Mikulėnas (grawity at gmail.com) wrote:
>
> > On Fri, Aug 27, 2021, 08:52 Nishant Nayan <nayan.nishant2000 at gmail.com>
> > wrote:
> >
> > > I have just started to learn journald and in its main function (in
> > > journald.c) I encountered a function call "log_set_prohibit_ipc(true);"
> > > In systemd source, I can see the declaration in src/basic/log.h:/*
> > >
> > > If turned on, then we'll never use IPC-based logging, * i.e. never log
> to
> > > syslog or the journal. We'll only * log to stderr, the console or kmsg
> > > */void log_set_prohibit_ipc(bool b);
> > >
> > > I did not get this because Journald not writing to journal itself by
> > > default is strange, isn't it?
> > > What is the reason behind it?
> > >
> >
> > My understanding is that the point isn't to prevent logging to journal,
> but
> > to prevent logging *through IPC* specifically, i.e. make sure journald
> > doesn't try to create loopback connections to its own sockets. The
> journald
> > daemon is single-threaded, so if it tries to connect to itself, it'll
> > deadlock.
> >
> > But also if journald wants to log a critical error (e.g. running out of
> > space or something like that), then it can't really *rely* on journal
> still
> > working...
> >
> > Afaik, messages written to kmsg will be imported back into the journal
> > anyway, but that happens asynchronously so it's fine.
>
> The above describes exactly how it is, and why journald turns of
> logging via IPC. journald should not be a client to itself.
>
> Lennart
>
> --
> Lennart Poettering, Berlin
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20210827/41a81f50/attachment.htm>


More information about the systemd-devel mailing list