I'm tailing logs of my own app and postgres.

tail -f /tmp/myapp.log /var/log/postgresql/postgresql.main.log

I need to include pgpool's logs. It used to be syslog but now it is in journalctl.

Is there a way to tie tail -f && journalctl -f together?


You could use:

journalctl -u service-name -f

-f, --follow

Show only the most recent journal entries, and continuously print new entries as they are appended to the journal.

Here I've added "service-name" to distinguish this answer from others; you substitute the actual service name instead of the text service-name.


You could forward your log entries to journal:

systemd-cat tail -f /tmp/myapp.log /var/log/postgresql.log

and then use journalctl -f... though as Mark mentioned, that will print all journal entries.

One way to filter only the messages from those logs and from that particular unit is to use a distinct SYSLOG_IDENTIFIER i.e. edit the unit file and under the [Service] section add e.g.


restart the unit then run systemd-cat with the same identifier

systemd-cat -t my_stuff tail -f /tmp/myapp.log /var/log/postgresql.log

and finally query the journal only for that particular identifier:

journalctl -f -t my_stuff

If you have bash available, you can use process substitution as one of the tail parameters:

tail -f /tmp/myapp.log /var/log/postgresql/postgresql.main.log <(journalctl -f)
  • 1
    This is the elegant way I also tried, but is doesn't work. Tail shows that it's using /dev/fd/xx, but no logs are displayed.
    – bikey
    Oct 7 '16 at 15:12
  • correct; /dev/fd/xxx is the temporary pipe that bash uses in order to implement the process substitution; any journalctl output will show up in there.
    – Jeff Schaller
    Oct 7 '16 at 15:13
  • 5
    You probably don't want to follow the whole journal but just those for the pgpool unit. Assuming the service named pgpool.service, try journalctl -fu pgpool.service. Also, if you are not running this as root, make sure the user is in the systemd-journal group! Oct 10 '16 at 13:50

try something like:

tail -f /tmp/myapp.log >> /tmp/tail.log &
journalctl -f >> /tmp/tail.log &
tail -f /tmp/tail.log

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.