Logger
Syslog Interaction Tool
The logger command is a powerful utility for
interacting with the syslog server on Unix-like systems. It allows
you to send messages to the system log with specified priorities and
facilities, making it invaluable for debugging, monitoring, and
system administration tasks. This tool helps developers quickly send
log entries from scripts or the command line.
Basic Usage and Examples
Here are some common ways to use the logger command:
# logger
# Interact with syslog server
# log "hi there" to syslog with priority 'notice' and facility 'user'
echo "hi there" | logger
# send <file> to syslog with <facility> and <level>
logger -p <facility>.<level> -f <file>
Understanding Syslog Priorities and Facilities
Syslog messages are categorized by both a facility and a priority level. Understanding these helps in filtering and analyzing logs effectively.
Syslog Levels (Priorities)
These indicate the severity of the message:
emerg: Emergency: system is unusablealert: Alert: action must be taken immediatelycrit: Critical: critical conditionserr: Error: error conditionswarning: Warning: warning conditions-
notice: Notice: normal but significant condition info: Informational: informational messagesdebug: Debug: debug-level messages
Syslog Facilities
These indicate the source of the message:
auth-
authpriv(for security information of a sensitive nature) crondaemonftplprmailnewssysloguseruucp-
local0tolocal7(local7is often used for boot messages)