Solaris 8 introduces the new NFS Server Logging utility. This
.
This utility provides functionality different from that provided by
the public domain tools previously discussed. These tools generate
records of individual RPC transactions, whereas NFS Server Logging
generates records of conceptual file operations. Network sniffer
tools like
report a file copy as a sequence of
distinct NFS read operations of certain length and offset performed
by the client. In contrast, the NFS Server Logging utility generates
a single record specifying the total transfer size and the duration
of the transfer. The NFS Server Logging utility reports accesses at
the conceptual level (file uploads or downloads), where network
sniffers report the details of the RPC and NFS operations.
Consequently, the logs generated by the NFS Server Logging utility
are orders of magnitude smaller and more manageable than sniffer
output. The NFS Server logs can be useful to determine the frequency
with which files in the archives are accessed or to determine what
NFS clients have accessed the files. These logs can be used to
manually or programmatically track access to objects within the
exported filesystem in the same way that FTP logs are used. As
previously pointed out, the information recorded in the NFS log is
not intended to serve as a debugging tool. The network sniffer tools
previously described are a better choice for that.
exports
a filesystem with NFS logging enabled. The client
to its local disk.
The NFS Server Logging utility records the access with a single
record of the form:
This entry indicates that on Fri Jul 28 2000 at 09:27:12 in the
morning, a file was downloaded by the host
.
The file was 136663 bytes in length and was located on the server at
/export/foo.tar.Z. The file was downloaded by userID 32721 using nfs.
The meaning of each field is explained in detail later in this
section.
14.6.2. 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, "NFS server logging configuration".
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, "Disabling NFS server logging".
To enable NFS Server Logging on a filesystem, the filesystem must
first be exported with the
-o log [=<tag>]
directive:
# 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.