Run /usr/local/bin/healthcheck and send both output streams to the journal with identifier healthcheck.
Which command is appropriate?
systemd-cat -t IDENTIFIER COMMAND runs a child command and forwards its output to the systemd journal.
Detailed explanation
journalctl -t healthcheck /usr/local/bin/healthcheckIncorrect. journalctl -t filters existing logs.
Incorrect. journalctl -t filters existing logs.
logger -t healthcheck -f /usr/local/bin/healthcheckIncorrect. logger -f reads file contents and does not execute the command.
Incorrect. logger -f reads file contents and does not execute the command.
rsyslogd -t healthcheck /usr/local/bin/healthcheckIncorrect. rsyslogd does not launch a child command this way.
Incorrect. rsyslogd does not launch a child command this way.
systemd-cat -t healthcheck /usr/local/bin/healthcheckCorrect. systemd-cat connects the child output to journald.
Correct. systemd-cat connects the child output to journald.
Try it yourself
An example you can run in a temporary verification environment.
systemd-cat --help | grep -E -- '--identifier|-t' | head -n 1Expected result
identifierを示すhelp行Key points
- systemd-cat bridges output
- -t sets identifier
- journalctl reads
Notes
- Environment: systemd-cat help / 子コマンド実行なし
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.