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.
logger -t healthcheck -f /usr/local/bin/healthcheckIncorrect. 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.
systemd-cat -t healthcheck /usr/local/bin/healthcheckCorrect. 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
Syslog facility and priority
Metadata that classifies a message source and its severity.
Journal persistence
Whether systemd journal data survives a reboot and where it is stored.
Log rotation
A process that retains, renames, compresses, or removes log generations.