LOGBOOK

HELP

Quiz Entry - updated: 2026.07.14

What is the logger command used for?

logger writes a message into the system log from the shell or a script — the proper way to make your own scripts log like any other service.

Rather than scattering echo into ad-hoc files, logger hands your message to syslog/journald, so it lands in the same place as everything else, with a proper timestamp, facility, and severity. That means your script's output is searchable with the same journalctl/grep workflow as system logs.

Basic usage:

logger "System backup completed"
logger -p auth.warning "Failed login attempt"

Options:

Option Description
-p facility.severity Set priority
-t tag Set program name tag
-i Include PID
-s Also output to stderr

Examples:

# Log backup script status
logger -t backup -p local0.info "Backup started"

# Log with priority
logger -p user.err "Something went wrong"

# In scripts
if [ $? -ne 0 ]; then
    logger -p daemon.err "Script failed"
fi

View your messages:

journalctl -t backup    # By tag
tail /var/log/messages  # In syslog

Tip: Use logger in scripts to create audit trails!

From Quiz: LIOS / Logs, Processes and Services | Updated: Jul 14, 2026