I have a vpn service unit for which I can view the logs with...

journalctl -u vpn

I also have a script that interacts with the vpn manually and is logged to journal with...

exec > >(systemd-cat -t vpn.sh) 2>&1

and I can view the logs with...

journalctl -t vpn.sh

I tried viewing both logs with...

journalctl -u vpn -t vpn.sh

but it didn't work.

Is there a way to view both logs at the same time? Or is it possible to set the identifier (-t vpn.sh) in the vpn service unit file to match the identifier of my script (vpn.sh).

3 Answers 3


TL;DR: This will work:

$ journalctl _SYSTEMD_UNIT=vpn.service + SYSLOG_IDENTIFIER=vpn.sh

You can use + to connect two sets of connections and look for journal log lines that match either expression. (This is documented in the man page of journalctl.)

In order to do that, you need to refer to them by their proper field names (the flags -u and -t are shortcuts for those.)

You can look at systemd.journal-fields(5) for the documentation of the field names. (That page will also explain why one of them has a leading underscore and the other one doesn't.)

For _SYSTEMD_UNIT you will need an exact match, including the .service suffix (the -u shortcut is smart and will find the exact unit name when translating it to a query by field.)

Putting it all together, you'll get the command above.


I found an alternate solution I wanted to post. Some people my find it useful. I can set the SyslogIdentifier under [Service] in the Unit file so that it matches the identifier in my script.


Description=vpn management service

ExecStart=/bin/bash /home/myusername/scripts/vpn.sh

So the identifier will now match that set in vpn.sh when I call the script manually. At the top of the script it is set with..

exec > >(systemd-cat -t vpn.sh) 2>&1

Now to see the logs from both systemd call to vpn.sh and manual call to vpn.sh..

journalctl -t vpn.sh --since today


journalctl SYSLOG_IDENTIFIER=vpn.sh --since today

It seems service name also works as identifiers. The coomands like below work for me.

journalctl -t vpn -t vpn.sh

-t, --identifier=SYSLOG_IDENTIFIER Show messages for the specified syslog identifier SYSLOG_IDENTIFIER.

   This parameter can be specified multiple times.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .