logger

Send messages to the system log (syslog/journald).

low risk

interactive breakdown — edit the command and press Explain
$ 
⚠ Risks & cautions
What it does

logger writes messages to the system journal or syslog. Used in scripts to emit structured log entries that appear in journalctl alongside system logs — crucial for script audit trails and integration with centralized logging.

Common flags
FlagMeaning
-t --tagAdd a tag/identifier to messages
-p --prioritySet message priority (e.g., user.error)
-s --stderrAlso print to stderr
-n --serverSend to remote syslog server
Examples
logger -t deploy 'Deployment v1.2.3 started by ec2-user'Log a tagged deployment event · explain & risk-check →
logger -p user.error -t myapp 'Database connection failed'Log an error with priority · explain & risk-check →
echo 'Backup complete' | logger -t backupPipe output to syslog · explain & risk-check →
Pro tip

Add `logger -t $(basename $0) "Starting: $0 $*"` to the top of every admin script — creates an automatic audit trail in journald for all script executions.

Related
journalctl systemctl tee
Open the full explainer →More in System & Processes

Reference text is hand-written and may be incomplete — check man logger for your version. Test destructive commands on a non-production system first.