[systemd-devel] How does journald talks to other services?

Nishant Nayan nayan.nishant2000 at gmail.com
Mon Aug 23 08:18:52 UTC 2021


I was using logger command to see if the logs goes to journal, and it does,
it goes both in /var/log/messages (owned by syslog) and journal, how is it
happening? Is it because journal listens to /dev/log ?
The following is from systemd-journald.socket
[Socket]
ListenStream=/run/systemd/journal/stdout
ListenDatagram=/run/systemd/journal/socket
ListenDatagram=/dev/log

Also can we edit 'systemd-journald.socket ' so as to not listen to /dev/log
? Just for seeing its behaviour.
I tried by commenting out and removing 'ListenDatagram=/dev/log' and
restarted the socket and journal service, but the logger log is still
displayed in journal

Nishant

On Fri, 20 Aug 2021 at 16:43, Mantas Mikulėnas <grawity at gmail.com> wrote:

> On Fri, Aug 20, 2021 at 2:11 PM Mantas Mikulėnas <grawity at gmail.com>
> wrote:
>
>> On Fri, Aug 20, 2021 at 2:10 PM Nishant Nayan <
>> nayan.nishant2000 at gmail.com> wrote:
>>
>>> Regarding the below point :
>>> c) The service prints to stdout/stderr, but systemd attaches the
>>> service's stdout/stderr to a pipe which is read by journald (using
>>> sd_journal_stream_fd(3) from libsystemd). See [Service] StandardOutput= in
>>> systemd.service(5).
>>>
>>> I did not see StandardOutput field in [Service] sections of a service
>>> file, for example sshd.service, but its logs are visible in journalctl.
>>> Is it by default piped to journal and we need to explicitly mention it
>>> (StandardOutput=)  only when we want to redirect it somewhere else?
>>>
>>
>> StandardOutput=journal is the default setting.
>>
>
> And, actually, sshd doesn't write its messages to stdout anyway – it uses
> syslog() via /dev/log; most daemons do.
>
> --
> Mantas Mikulėnas
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20210823/18053974/attachment.htm>


More information about the systemd-devel mailing list