Re: [systemd-devel] How does journald talks to other services?
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 wrote: > On Fri, Aug 20, 2021 at 2:11 PM Mantas Mikulėnas > wrote: > >> On Fri, Aug 20, 2021 at 2:10 PM Nishant Nayan < >> nayan.nishant2...@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 >
Re: [systemd-devel] How does journald talks to other services?
On Mon, Aug 23, 2021, 11:19 Nishant Nayan wrote: > 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 ? > Journald listens to /dev/log and writes messages to its .journal files. Then a syslog daemon (rsyslogd or syslog-ng) receives the same messages *from* journald, in one of two ways, and writes them to /var/log/messages: a) The syslog daemon directly reads messages with full metadata from .journal files (e.g. in rsyslogd this is the imjournal module); or b) The syslog daemon listens on a completely separate socket in /run, and journald forwards all messages to that socket (without metadata) using the traditional syslog protocol. 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 > Technically that should work? But don't use it for other reasons except testing, I'd say... Did you systemctl daemon-reload? Is /dev/log a real socket or a symlink? (In later systemd versions it's a symlink and the real socket is in /run.) If it's a real socket, does it get re-created after 'rm'? > > > Nishant > > On Fri, 20 Aug 2021 at 16:43, Mantas Mikulėnas wrote: > >> On Fri, Aug 20, 2021 at 2:11 PM Mantas Mikulėnas >> wrote: >> >>> On Fri, Aug 20, 2021 at 2:10 PM Nishant Nayan < >>> nayan.nishant2...@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 >> >
Re: [systemd-devel] How does journald talks to other services?
yes, I did daemon-reload and restarted the service and socket /dev/log is a real socket , it gets re-created on rm. Although, i have another system where /dev/log is a symlink On Mon, 23 Aug 2021 at 14:02, Mantas Mikulėnas wrote: > On Mon, Aug 23, 2021, 11:19 Nishant Nayan > wrote: > >> 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 ? >> > > Journald listens to /dev/log and writes messages to its .journal files. > Then a syslog daemon (rsyslogd or syslog-ng) receives the same messages > *from* journald, in one of two ways, and writes them to /var/log/messages: > > a) The syslog daemon directly reads messages with full metadata from > .journal files (e.g. in rsyslogd this is the imjournal module); > > or b) The syslog daemon listens on a completely separate socket in /run, > and journald forwards all messages to that socket (without metadata) using > the traditional syslog protocol. > > 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 >> > > Technically that should work? But don't use it for other reasons except > testing, I'd say... > > Did you systemctl daemon-reload? > > Is /dev/log a real socket or a symlink? (In later systemd versions it's a > symlink and the real socket is in /run.) > > If it's a real socket, does it get re-created after 'rm'? > > >> >> >> Nishant >> >> On Fri, 20 Aug 2021 at 16:43, Mantas Mikulėnas wrote: >> >>> On Fri, Aug 20, 2021 at 2:11 PM Mantas Mikulėnas >>> wrote: >>> On Fri, Aug 20, 2021 at 2:10 PM Nishant Nayan < nayan.nishant2...@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 >>> >>
Re: [systemd-devel] Mobile broadband modems support in systemd-networkd
Hi Bruce, Am Fr, 20. Aug 2021, um 22:01, schrieb Bruce A. Johnson: > Mantas' and Ulrich's responses gave me insights to dig more. Neither the > mbim-cli nor ModemManager sets the IP address on the interface, and some > kind of agent needs to do that. > > When I start the connection using ModemManager, I am able to retrieve > addresses that mmcli displays like the below. If I manually assign the > IPv4 address to the interface and set up the route, I'm able to send > traffic to and from other nodes. I haven't yet looked into how > ModemManager communicates this info to NetworkManager or how things like > a change of address are handled. As I see it, these addresses aren't > really static, because the IPv6 addresses are different from one mobile > session to the next. > > > > > IPv4 configuration | method: static > > | address: 6.147.139.XXX > > | prefix: 30 > > | gateway: 6.147.139.YYY > > | dns: 10.177.0.34, 10.177.0.210 > > | mtu: 1500 > > > > IPv6 configuration | method: static > > | address: 2607:fb90:648f:2648:a5b3:8146:95aa:2955 > > | prefix: 64 > > | gateway: 2607:fb90:648f:2648:68d8:1c67:a27:b968 > > | dns: fd00:976a::9, fd00:976a::10 > > | mtu: 1500 > > > I took a closer look at what's going on with systemd-networkd, and I > found whether I use ModemManager or mbim-cli to connect to the mobile > network, the .network file will be processed, but _only after I restart > systemd-networkd_. I'm not 100% sure this applies to all the applications in the systemd ecosystem (like systemd-networkd), but systemd is reloading .unit, .service, .mount and all the other files there are only after a `systemctl daemon-reload`. That's the intended behaviour. Just wanted to mention this. Can't comment on anything else, though, as I have no clue either. But I'm interested in this topic and am silently monitoring this thread. Regards, Manuel
Re: [systemd-devel] Mobile broadband modems support in systemd-networkd
I wasn't clear what I meant about processing of the .network file. With Ethernet or Wi-Fi (using iwd), when the link comes up, systemd-networkd does the Right Thing and starts network services on the interface, running a DHCP client or setting up static address(es), routes, etc., as specified in the .network file. When ModemManager establishes the connection with the 3G carrier, systemd-networkd seems to be unaware of the event, and I have to poke it with "systemd restart systemd-networkd" or "networkctl reload" before it tries to use the information in the .network file for the interface. It seems to me like that ought to happen automatically. I suspect that ModemManager needs to be changed to inform systemd-networkd. So far, it's not looking like there's an effort to integrate ModemManager (or something similar) with systemd-networkd, which is kind of a shame. If I come up with anything useful toward making that happen, I'll offer a pull request, but at the moment I'm looking at cobbling something together with Python. Bruce A. Johnson | Firmware Engineer Blue Ridge Networks, Inc. 14120 Parke Long Court Suite 103 | Chantilly, VA 20151 Main: 1.800.722.1168 | Direct: 703-633-7332 http://www.blueridgenetworks.com OpenPGP key ID: 296D1CD6F2B84CAB https://keys.openpgp.org/ On 23/08/2021 16:11, Manuel Wagesreither wrote: I took a closer look at what's going on with systemd-networkd, and I found whether I use ModemManager or mbim-cli to connect to the mobile network, the .network file will be processed, but _only after I restart systemd-networkd_. I'm not 100% sure this applies to all the applications in the systemd ecosystem (like systemd-networkd), but systemd is reloading .unit, .service, .mount and all the other files there are only after a `systemctl daemon-reload`. That's the intended behaviour. Just wanted to mention this. Can't comment on anything else, though, as I have no clue either. But I'm interested in this topic and am silently monitoring this thread. OpenPGP_signature Description: OpenPGP digital signature
Re: [systemd-devel] How does journald talks to other services?
So what are the cases where syslog forwards logs to journal? Is there a case where both journal and syslog end up sending same logs to each other ( like a cycle ) resulting in duplicate logs? Nishant On Mon, 23 Aug 2021, 14:02 Mantas Mikulėnas, wrote: > On Mon, Aug 23, 2021, 11:19 Nishant Nayan > wrote: > >> 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 ? >> > > Journald listens to /dev/log and writes messages to its .journal files. > Then a syslog daemon (rsyslogd or syslog-ng) receives the same messages > *from* journald, in one of two ways, and writes them to /var/log/messages: > > a) The syslog daemon directly reads messages with full metadata from > .journal files (e.g. in rsyslogd this is the imjournal module); > > or b) The syslog daemon listens on a completely separate socket in /run, > and journald forwards all messages to that socket (without metadata) using > the traditional syslog protocol. > > 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 >> > > Technically that should work? But don't use it for other reasons except > testing, I'd say... > > Did you systemctl daemon-reload? > > Is /dev/log a real socket or a symlink? (In later systemd versions it's a > symlink and the real socket is in /run.) > > If it's a real socket, does it get re-created after 'rm'? > > >> >> >> Nishant >> >> On Fri, 20 Aug 2021 at 16:43, Mantas Mikulėnas wrote: >> >>> On Fri, Aug 20, 2021 at 2:11 PM Mantas Mikulėnas >>> wrote: >>> On Fri, Aug 20, 2021 at 2:10 PM Nishant Nayan < nayan.nishant2...@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 >>> >>
Re: [systemd-devel] How does journald talks to other services?
On Di, 24.08.21 09:11, Nishant Nayan (nayan.nishant2...@gmail.com) wrote: > So what are the cases where syslog forwards logs to journal? > Is there a case where both journal and syslog end up sending same logs to > each other ( like a cycle ) resulting in duplicate logs? systemd does not pick up messages from another syslog service, only from syslog clients. Thus, there is no loop. Lennart -- Lennart Poettering, Berlin