Ask Your Question
1

How to add a custom log to the journal in systemd?

asked 2014-01-05 17:34:07 -0500

terminalid gravatar image

updated 2014-09-30 06:51:43 -0500

mether gravatar image

I have a custom backup script that uses its own log file /var/log/backup. The script contains lines like:

echo "`date` Backup failed!" >> /var/log/backup

What is the appropriate solution for this use case in systemd's journal?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2014-01-05 18:19:55 -0500

Use systemd-cat . For example:

echo "Backup Failed" | systemd-cat --identifier "terminalid-home_backup" --priority "crit"

...the date will be recorded by the journal automatically, of course.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-01-05 17:34:07 -0500

Seen: 7,760 times

Last updated: Jan 06 '14