Menu

UNIX TUTORIALS - Unix - System Logging

Unix - System Logging

ADVERTISEMENTS

TermDescription
FacilityThe identifier used to describe the application or process that submitted the log message. Examples are mail, kernel, and ftp.
PriorityAn indicator of the importance of the message. Levels are defined within syslog as guidelines, from debugging information to critical events.
SelectorA combination of one or more facilities and levels. When an incoming event matches a selector, an action is performed.
ActionWhat happens to an incoming message that matches a selector. Actions can write the message to a log file, echo the message to a console or other device, write the message to a logged in user, or send the message along to another syslog server.

ADVERTISEMENTS

Syslog Facilities:

FacilityDescription
authActivity related to requesting name and password (getty, su, login)
authprivSame as auth but logged to a file that can only be read by selected users
consoleUsed to capture messages that would generally be directed to the system console
cronMessages from the cron system scheduler
daemonSystem daemon catch-all
ftpMessages relating to the ftp daemon
kernKernel messages
local0.local7Local facilities defined per site
lprMessages from the line printing system
mailMessages relating to the mail system
markPseudo event used to generate timestamps in log files
newsMessages relating to network news protocol (nntp)
ntpMessages relating to network time protocol
userRegular user processes
uucpUUCP subsystem

ADVERTISEMENTS

Syslog Priorities:

PriorityDescription
emergEmergency condition, such as an imminent system crash, usually broadcast to all users
alertCondition that should be corrected immediately, such as a corrupted system database
critCritical condition, such as a hardware error
errOrdinary error
warningWarning
noticeCondition that is not an error, but possibly should be handled in a special way
infoInformational message
debugMessages that are used when debugging programs
nonePseudo level used to specify not to log messages.

The logger Command:

OptionDescription
-f filenameUse the contents of file filename as the message to log.
-iLog the process ID of the logger process with each line.
-p priorityEnter the message with the specified priority (specified selector entry); the message priority can be specified numerically, or as a facility.priority pair. The default priority is user.notice.
-t tagMark each line added to the log with the specified tag.
messageThe string arguments whose contents are concatenated together in the specified order, separated by the space

Important Log Locations

ApplicationDirectory
httpd/var/log/httpd
samba/var/log/samba
cron/var/log/
mail/var/log/
mysql/var/log/

The /etc/syslog.conf file:

*.err;kern.debug;auth.notice /dev/console
daemon,auth.notice           /var/log/messages
lpr.info                     /var/log/lpr.log
mail.*                       /var/log/mail.log
ftp.*                        /var/log/ftp.log
auth.*                       @prep.ai.mit.edu
auth.*                       root,amrood
netinfo.err                  /var/log/netinfo.log
install.*                    /var/log/install.log
*.emerg                      *
*.alert                      |program_name
mark.*                       /dev/console

The logger Command:

logger [-i] [-f file] [-p priority] [-t tag] [message]...