Inject custom log entries from shell scripts or the command line into the system log. 03.04.2026 | reading time: 2 min Need to record events from a script, cron job or ad hoc command directly into the system log? Use `logger` to send a line to syslog with a chosen facility and priority so the message appears where your syslog configuration expects it. A practical quick run Try this: write a message and check the system log to see it appear; the commands show the whole flow: ```bash echo 'Backup complete' | logger -p local0.info -t backup-script # then inspect the log tail -n 5 /var/log/syslog Apr 03 12:34:56 myhost backup-script: Backup complete ``` Options you will use most Master these switches: `-p` sets facility and priority like `local0.info`, `-t` sets a tag to identify the source, `-i` adds the process id, `-s` also writes the message to standard error, `-f` reads message lines from a file, and `-n` / `-P` send messages to a remote syslogd; combine them to record context and to route messages where administrators expect them. Real scenarios to apply it Log from cron so admins can trace automated jobs, report script errors with a tag and PID for faster debugging, forward alerts to a remote log host for centralized auditing, or use `logger` in deployment hooks to create reliable audit trails during upgrades. Tools nearby on the stack Remember that `logger` injects messages into syslog infrastructure; the messages are then handled by daemons like rsyslog or syslog-ng or collected by systemd-journald and queried with tools such as `journalctl` or `tail` depending on your distro. Next steps and motivation Start adding `logger` calls to scripts that matter and watch how structured tags and priorities simplify troubleshooting; keep practicing, read syslog daemon filters, and if certification interests you consider deepening your skills for CompTIA Linux+ or LPIC-1 with focused exam preparation at bitsandbytes.academy. Join Bits & Bytes Academy First class LINUX exam preparation. utilities security scripting troubleshooting infrastructure