System Administration Guide: Resource Management and Network Services

How to Enable NFS Server Logging

  1. Become superuser or assume an equivalent role.

    For information about roles, see “Using Privileged Applications” in System Administration Guide: Security Services.

  2. (Optional) Change file-system configuration settings.

    In /etc/nfs/nfslog.conf, you can change the settings in one of two ways. You can edit the default settings for all file systems by changing the data that is associated with the global tag. Alternately, you can add a new tag for this file system. If these changes are not needed, you do not need to change this file. The format of /etc/nfs/nfslog.conf is described in nfslog.conf(4).

  3. Add entries for each file system to be shared by using NFS server logging.

    Edit /etc/dfs/dfstab. Add one entry to the file for the file system on which you are enabling NFS server logging. The tag that is used with the log=tag option must be entered in /etc/nfs/nfslog.conf. This example uses the default settings in the global tag.

    share -F nfs -o ro,log=global /export/ftp

    See the dfstab(4) man page for a description of /etc/dfs/dfstab and the share_nfs(1M) man page for a complete list of options.

  4. Check if the NFS service is running on the server.

    If this is the first share command or set of share commands that you have initiated, the NFS daemons might not be running. Check that one of the NFS daemons is running by using the following command.

    # pgrep nfsd

    318 is the process ID for nfsd in this example. If an ID is not displayed, then the service is not running. The second daemon to check for is mountd.

  5. (Optional) Start the NFS service.

    If the previous step does not report a process ID for nfsd, start the NFS service by using the following command.

    # /etc/init.d/nfs.server start

    This command ensures that NFS service is now running on the servers and restarts automatically when the server is at run level 3 during boot.

  6. (Optional) Share the file system.

    After the entry is in /etc/dfs/dfstab, the file system can be shared by either rebooting the system or by using the shareall command. If the NFS service was started earlier, this command does not need to be run because the script runs the command.

    # shareall
  7. Verify that the information is correct.

    Run the share command to check that the correct options are listed:

    # share
    -        /export/share/man   ro   ""
    -        /usr/src     rw=eng   ""
    -        /export/ftp    ro,log=global  ""
  8. (Optional) Start the NFS log daemon, nfslogd, if it is not running already.

    Restarting the NFS daemons by using the nfs.server script starts the daemon if the nfslog.conf file exists. Otherwise, the command needs to be run once by hand to create the files so that the command automatically restarts when the server is rebooted.

    # /usr/lib/nfs/nfslogd