[systemd-devel] Logs from a service is not showing up in journalctl but showing up in syslog
Lennart Poettering
lennart at poettering.net
Mon Jul 29 12:35:00 UTC 2019
On Do, 25.07.19 15:55, Debraj Manna (subharaj.manna at gmail.com) wrote:
> I have unit file which looks like below. I am seeing some of the echo are
> showing up in syslog but not in journalctl. Can someone let me know what is
> going on?
> systemd version 229 running on Ubuntu 16.
>
> ExecStartPre=-/bin/su ubuntu -c
> "/home/ubuntu/build-target/kafka/kafka-systemd-prestart.sh"
> ExecStart=/bin/su ubuntu -c
> "/home/ubuntu/build-target/kafka/kafka-systemd-health.sh"
If you use "su" this creates a new login session (and thus a scope
unit) for your program, and thus any processes/logs will be associated
with that login session scope unit, and not with the service unit you
are writing here.
Use "User=" to run services under specific user identities. Or at
least use "setpriv" rather than "su" since the former just changes
privs, but doesn't actually acquire a PAM session and everything.
Lennart
--
Lennart Poettering, Berlin
More information about the systemd-devel
mailing list