|
Softpanorama |
May the source be with you, but remember the KISS principle ;-)
|
If enabled, the operations of a NFS server can be loged in a special log file. This function is implemented by the NFS Logging Daemon (/usr/lib/nfs/nfslogd) controlled by a configuration file (/etc/default/nfslogd).
The location of the NFS server logs and the nfslogd working files are specified by the NFS server logging configuration file (/etc/nfs/nfslog.conf).
The NFS Logging Daemon monitors and analyzes Remote Procedure Call (RPC) operations processed by the NFS server. For file systems exported (shared) with logging enabled, each RPC operation is stored in the NFS log file as a record.
Each record consists of the following:
The NFS server logging consists of two phases. The first phase is performed by the kernel; it records RPC requests in a work buffer. The second phase is performed by the daemon; it reads the work buffer and constructs the log records. The amount of time the daemon waits before reading the work buffer along with other configurable parameters are specified in the /etc/default/nfslogd file.
Because NFS uses file handles instead of pathnames, a database that maps these file handles to pathnames is maintained as part of the logging operation.
The following configuration parameters, as defined in the /etc/default/nfslogd file, affect the behavior of the NFS logging daemon. The initial nfslogd provided with the Solaris 9 system contains only comments.
CYCLE_FREQUENCY— Amount of time (in hours) of the log cycle (close current log and open new one). This is to prevent the logs from getting too large.
IDLE_TIME— Amount of time (in seconds) that the logging daemon will sleep while waiting for data to be placed in the work buffer.
MAPPING_UPDATE_INTERVAL— The amount of time (in seconds) between updates of the file handle to pathname mapping database.
MAX_LOGS_PRESERVE— The maximum number of log files to save.
MIN_PROCESSING_SIZE— Minimum size (in bytes) of the work buffer before the logging daemon will process its contents.
PRUNE_TIMEOUT— The amount of time (in hours) the access time of a file associated with a record in the pathname mapping database can remain unchanged before it is removed.
UMASK— umask used for the work buffer and file handle to pathname mapping database.
The /etc/nfs/nfslog.conf file is used to specify the location of log files, file handle to pathname mapping database, and work buffer, along with a few other parameters. Because a set of parameters are grouped together and are associated with a tag or name, multiple instances of configurations can be specified in the configuration file. The default configuration, which has the tag global can be modified or additional configurations can be specified. The /etc/nfs/nsflog.conf file can be used to set the following NFS logging parameters:
buffer— Specifies location of working buffer.
defaultdir— Specifies the default directory of files. If specified, this path is added to the beginning of other parameters that are used to specify the location of files.
fhtable— Specifies location of the file handle to pathname mapping database.
log— Specifies location of log files.
logformat— Specifies either basic (default) or extended logging.
The following listing shows the default contents of the /etc/nfs/nfslog.conf file:
#ident "@(#)nfslog.conf 1.5 99/02/21 SMI" # # Copyright (c) 1999 by Sun Microsystems, Inc. # All rights reserved. # # NFS server log configuration file. # # <tag> [ defaultdir=<dir_path> ] \ # [ log=<logfile_path> ] [ fhtable=<table_path> ] \ # [ buffer=<bufferfile_path> ] [ logformat=basic|extended ] # global defaultdir=/var/nfs \ log=nfslog fhtable=fhtable buffer=nfslog_workbuffer $
If neither the NFS server nor NFS Logging Daemon is running, you can start NFS using the /etc/init.d/nfs.server start command.
Logging is enabled on a per-share (file system/directory) basis, by adding the -o log option to the share(1M) command associated with the share. If the share is currently shared, you must unshare it first. Then modify the share command associated with the share in the /etc/dfs/dfstab file (and execute shareall) or enter it at the command line.
Copyright © 1996-2008 by Dr. Nikolai Bezroukov. www.softpanorama.org was created as a service to the UN Sustainable Development Networking Programme (SDNP) in the author free time. Submit comments This document is an industrial compilation designed and created exclusively for educational use and is placed under the copyright of the Open Content License(OPL). Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.
Standard disclaimer: The statements, views and opinions presented on this web page are those of the author and are not endorsed by, nor do they necessarily reflect, the opinions of the author present and former employers, SDNP or any other organization the author may be associated with. We do not warrant the correctness of the information provided or its fitness for any purpose.
Last modified: February 28, 2008