systemdjournal

How to redirect log file content to systemd journal?


I have a program that accept a --log-file parameter. I want to wrapper this program into a systemd service, and write the log to the journal.

The program can run in daemon mode, and supports restart and stop actions.

I found a systemd-cat, but it only accept a pipe.


Solution

  • Try using the bash feature of process substitution.

    myapp --log-file >(systemd-cat)