I have a process which is started by systemd - lets call it A. This process spawns numerous child processes - lets just take one and call it B.
This is a C++ application. When you print to std::cout the output is captured by systemd and can be viewed with the journalctl command.
Whenever a message is printed to std::cout from process A it appears in the journalctl output with the name of process A preceding the log message - makes sense.
Nov 09 16:27:17 hostname processA : message from process A
Whenever a message is printed from process B, however, the message that is printed is still preceded by the name of process A.
Nov 09 16:27:18 hostname processA : message from process B
I presume this is expected behaviour as it displaying the name of the process that was actually started by systemd - disregarding the fact it was raised by a child of that process. It does appear as if systemd is aware of there being multiple processes when you use the
systemctl status processA command though:
Active: active (running) since Wed 2016-11-09 16:27:20 GMT; 30min ago Main PID: 1417 (processA) CGroup: /system.slice/processA.service ├─1417 /opt/test/bin/processA ├─1450 /opt/test/bin/processB
My question is: Is there a way for the output in journalctl to display the child process name when it's output is captured?