Is it possible to change what tag systemd managed service uses for logging? For example, my custom service report-daemon.service
defined as
# ...
[Service]
ExecStart=/usr/bin/php # ...
# ...
shows up as php
instead of report-daemon
(it seems to infer the tag from ExecStart
)
$ sudo journalctl --unit report-daemon
# ...
May 30 16:26:11 delta php[994]: Found 0 new revisions for Ctytn4a6zjw
May 30 16:26:12 delta php[994]: Found 0 new revisions for efE8xuvUjAo
# ...
Man page does not list any option for setting this in unit file. Is it possible to change the tag somewhere?
Best Answer
Update 1: The verbose option will list in long format and so includes the UNIT:
Update 2: Python script to print wanted entries:
Have a look at this example from nginx:
Somebody comes along and does a ps to find and kill nginx:
The journal now contains:
Observe how the column where you are seeing only php contains the name of the process that is acting upon the nginx systemd unit, systemd, nginx, kill are all listed there. Does that help to explain.
The unit name is given to it by the filename. On a Centos 7 I did:
Stop the original nxginx:
Look at and start "newnginx":
Journalctl now lists the
newnginx
unit:There are now two nginx systemd units: