Softpanorama
(slightly skeptical) Open Source Software Educational Society

May the source be with you, but remember the KISS principle ;-)

Google   


Solaris NFS Logging

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).

NFS Logging Daemon

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 /etc/default/nfslogd File

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.

The /etc/nfs/nfslog.conf File

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:

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
$


Enabling NFS Server Logging

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