Managing NFS and NIS, 2nd Edition - Mike Eisler [220]
Table 14-2. NFS server logging files
File
Contents
Creator/ Modifier
Consumer
/etc/nfs/nfslog.conf
Logging configuration
Administrator
share, nfslogd
/etc/default/nfslogd
nfslogd-specific configuration
Administrator
nfslogd
/etc/nfs/nfslogtab
Information on location of the work buffer files
share, unshare nfslogd
nfslogd
/var/nfs/nfslog
NFS transaction log records
nfslogd
Administrator
/var/nfs/nfslog_workbuffer
RPC operations recorded by the kernel and consumed by the nfslogd daemon
Unix kernel
nfslogd
/var/nfs/fhpath
filehandle to path mapping
nfslogd
nfslogd
Enabling NFS server logging
Before enabling logging on a filesystem, make sure to first define the default directory where the NFS log and working files are to be created. Solaris ships with the default directory set to /var/nfs. Make sure you have enough disk space available in /var/nfs or set the default directory to a different partition. Instructions on how to change the default directory and how to spread the logs and files across multiple partitions are provided in Section 14.6.3.
Once the location of the files has been specified, logging NFS traffic on a filesystem is simple. First, export the filesystem using the -o log directive. Second, start the nfslogd daemon if it is not yet running. The NFS log file will be created a few minutes later in the directory previously specified, after the kernel has gathered enough information to generate the NFS transaction records. Note that setting the -o log directive in the /etc/dfs/dfstab file will cause the nfslogd daemon to be started automatically the next time the machine is booted. The daemon will automatically detect when other filesystems are shared with logging enabled.
The rest of the chapter explains the specifics of how the NFS Server Logging mechanism works, its main components, and configuration parameters. Enabling logging is straightforward, unfortunately cleaning up working files after logging has been disabled requires some manual work. We will explain this in Section 14.6.9.
To enable NFS Server Logging on a filesystem, the filesystem must first be exported with the -o log [= # share -o log /export When no tag is specified, the kernel will record the temporary RPC information in the default work buffer file /var/nfs/nfslog_workbuffer_in_process. Again, this temporary file does not contain any information useful to the user, instead it's used by the NFS Logging mechanism as a temporary buffer. It is the nfslogd daemon that reads this work buffer, processes its information, and generates the NFS log file. By default, the NFS log file is stored in /var/nfs/nfslog. The nfslogd daemon must be running in order to generate the NFS log file. Note that the daemon is started at boot time only when one or more filesystems in /etc/dfs/dfstab have the -o log directive specified. If you share a filesystem manually with logging enabled and the nfslogd daemon had not previously been started, you must invoke it manually: # /usr/lib/nfs/nfslogd To assure that the nfslogd daemon is started after a reboot, make sure to specify the -o log directive in /etc/dfs/dfstab. NFS server logging configuration By default, the NFS log file, the temporary work buffer files, and the filehandle mapping tables are created in the /var/nfs directory. These defaults can be overridden by sharing the filesystem with specific logging parameters associated with a logging tag. Logging tags are defined in the /etc/nfs/nfslog.conf file. Each entry in the file consists of a mandatory tag identifier and one or more logging parameters. The following is a sample /etc/nfs/nfslog.conf configuration file: # NFS server log configuration file.