[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

System Management Guide: Communications and Networks


SNMP Daemon Logging Facility

Logging activities for the snmpd daemon can be handled in three ways:

The debug level of the snmpd logging messages is user-configurable. The debug level can be one of the following:

0 All NOTICES, EXCEPTIONS, and FATAL messages
1 Level 0 plus DEBUG messages
2 Level 1 plus a hexadecimal dump of the request and response packets
3 Level 2 plus an English version of the request and response packets.

The default debug level is 0. Level 3 messages are not written by the syslogd daemon.

If the snmpd daemon is configured for logging, logging can be toggled on and off by issuing a SIGUSR1 signal, or a kill -30 to the snmpd daemon. If the snmpd daemon is invoked under System Resource Controller (SRC) control, the SRC traceson and tracesoff commands can also be used to start and stop the logging process. If logging is activated, the tracesoff command stops logging. Likewise, if logging is temporarily disabled, the traceson command can be used to restart the logging. If the snmpd daemon is not configured for logging, these commands have no effect. These commands have no effect on logging by the syslogd daemon.

Should the log file reach the file size limit, the snmpd daemon rotates the log file. The snmpd daemon keeps up to four levels of rotated log files. For example, if you name the log file LogFile, the files are rotated as follows:

If you are logging with syslogd at the same time, a log message is logged by the syslogd daemon stating that the log files are rotating. The syslogd log file is not rotated by the snmpd daemon.

If the snmpd daemon is invoked under SRC control, the lssrc command with the long status option lists the snmpd logging parameters. The lssrc command does not display information about the syslogd logging activities.

Logging Directed from the snmpd Command Line

To direct logging from the snmpd command line, the -f flag must be specified at the snmpd invocation. If the -f flag is not specified, logging cannot be directed from the command line. If the -f flag is specified, the full path name and file name of the logging file must be specified as the snmpd daemon forks and changes to the root directory at startup. If the snmpd daemon cannot open the file, the snmpd daemon directs logging from the configuration file. If syslogd is also handling snmpd log messages, an EXCEPTIONS message is logged to the syslogd log file stating the reason why the snmpd log file could not be opened. If the log file specified with the -f flag is successfully opened, the log file cannot be changed during execution of the snmpd daemon.

The debug level is specified on the snmpd command line with the -d flag. If the -d flag is not specified, the debug level defaults to 0. The debug level cannot change during execution of the snmpd daemon.

The size of the log file is unlimited; that is, it will be the system maximum file size.

If logging is directed from the command line, logging entries in the configuration file are ignored, both at startup and during any refresh of the snmpd daemon.

See the snmpd command in in AIX 5L Version 5.1 Commands Reference.

Logging Directed from the Configuration File

To direct logging from the configuration file, the -f flag must not be specified on the snmpd command line. If the -d flag is specified on the snmpd command line, the debug level specified with the -d flag becomes the default debug level. If the -d flag is not specified on the snmpd command line, the default debug level is 0.

The logging parameters are specified in logging entries in the snmpd configuration file. The configurable logging parameters include: log file name, maximum log file size, debug level, and enablement. If the log file name is not specified, logging is not enabled. Because the snmpd daemon forks and changes to the root directory at startup, the full path name of the log file must be specified. The default enablement is disabled. Thus, if the enablement parameter is not specified as enabled, logging to the log file does not take place.

The default file size is unlimited; that is, it defaults to the system maximum file size.

The snmpd configuration file is read at snmpd startup and upon a refresh. Thus, logging parameters do not need to be specified before the snmpd daemon is invoked. Because the file is reread when the snmpd daemon receives a refresh (if snmpd is started under SRC control) or a SIGHUP signal (kill -1), the logging parameters can be specified at any time. In addition, the logging parameters can be changed at any time during the running of the snmpd daemon.

See the snmpd.conf file for more information on how to configure the snmpd daemon for logging directed from the configuration file.

Logging by the syslogd Daemon

Logging by the syslogd daemon can take place alone or in conjunction with logging directed from either the snmpd command line or configuration file.

To configure the syslogd daemon to log messages for the snmpd daemon, you must be the root user. Edit the /etc/syslog.conf file and add an entry such as the following:

daemon.debug     /var/tmp/snmpd.syslog

The /var/tmp/snmpd.syslog file must exist before the syslogd daemon rereads the /etc/syslog.conf configuration file in order for the syslogd daemon to log the snmpd daemon log messages to this file. To create this file, issue the following command:

touch /var/tmp/snmpd.syslog

Then issue the following command to force the syslogd daemon to reread its configuration file:

refresh -s syslogd

Note that the syslogd daemon logs all daemon messages to this log file, not just the snmpd log messages.

If the syslogd daemon is configured to log messages from the daemon facility at the syslogd LOG_DEBUG severity level and higher, all messages at snmpd debug level 2 or lower from the snmpd daemon can be logged into a syslogd configured file. If level 3 is specified as the snmpd debug level, the syslogd daemon logs only snmpd level 2 messages.

If logging is to be handled solely by the syslogd daemon, first the syslogd daemon must be configured for logging as described previously. The snmpd daemon debug level must be specified on the command line with the -d option, or else in the configuration file in a logging entry in the level=Value field. If no debug level is specified, the default level of 0 is used. If logging is directed from the snmpd configuration file, the debug level can change during running of the snmpd daemon.

The SIGUSR1 signal (kill -30) and the SRC traceson and tracesoff commands have no effect on logging by the syslogd daemon.

No logging takes place if the snmpd daemon or the syslogd daemon are not configured to log messages as directed by the snmpd command line or configuration file.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]