Information Technology Reference
In-Depth Information
The ifdef() macro provides a conditional control statement. If condition is
true, the define_if_true expression is in effect. If not, the define_if_false
expression is in effect.
The only relevant condition for the /etc/syslog.conf file is the LOGHOST
keyword. This keyword is used to determine whether the local system has an
alias of loghost in the /etc/hosts file. This alias indicates that the associat-
ed host is configured to store local syslog messages and possibly syslog mes-
sages from remote hosts. The following /etc/hosts entry shows the
solaris8 system as being identified as loghost :
192.168.99.9 solaris9 loghost
The following listing shows a typical example of using an m4 ifdef macro in
the action column of the /etc/syslog.conf file:
auth.notice ifdef(`LOGHOST', /var/log/authlog, @loghost)
This specifies that for auth.notice messages, if the local system is identified
in the /etc/hosts file as loghost , add the message to the /var/log/authlog
file. Or if the local system is not identified as the loghost , forward it to the
system identified as the loghost .
The following listing uses an m4 ifdef macro to optionally define entire
/etc/syslog.conf file entries based on the local system not being the
loghost :
ifdef(`LOGHOST', ,
user.err /dev/sysmsg
user.err /var/adm/messages
user.alert `root, operator'
user.emerg *
)
This specifies that if the local system is defined as loghost , do nothing (the
define_if_true expression is blank). If the local system is not loghost ,
process the user.err (and user.crit ), user.alert , and user.emerg messages
locally. Keep in mind that messages at the specified severity level, as well as
all higher severity levels, are processed by the /etc/syslog.conf entries.
The /etc/syslog.conf File
Entries in the /etc/syslog.conf file determine the handling of syslog mes-
sages. The syslogd daemon reads the /etc/syslog.conf file whenever it is
started, or when it is sent the SIGHUP(1) signal. Table 13.4 summarizes the
default syslog message handling ( /etc/syslog.conf contents) for systems
that log messages locally. The previously described m4 macro for user mes-
sages is also included.
Search WWH ::




Custom Search