Configuring NFS server logging on Solaris 10
A Logbook was originally a book for recording readings from the log, and is used to determine the distance a ship traveled within a certain amount of time. The readings of the log have been recorded in equal times to give the distance traveled with respect to a given start position. [http://en.wikipedia.org/wiki/Logbook]
First off, this article is about NFS v2/v3 server logging…
From Solaris 10 u4 nfslogd manual page:
... NFS server logging is not supported on Solaris machines that are using NFS Version 4. ...
I don’t know if you configure the version 3 and version 4 NFS protocols, the logging will be enabled. By the manual page i understand that if the v4 is enabled, there is no logging. I have not even tried it, make your tests…
I will not use NFS v4 in this lab, just v3, so the first step is configure the file /etc/default/nfs. In that file you will need to configure four parameters:
NFS_SERVER_VERSMIN=3 NFS_SERVER_VERSMAX=3 NFS_CLIENT_VERSMIN=3 NFS_CLIENT_VERSMAX=3
Now we can configure our export file to enable logging in each exported filesystem. Just add to the options’ list of your exported filesystem the log=yourtag directive.
Ok, now we can configure the configuration file /etc/nfs/nfslog.conf, where we will use the yourtag value to organize the logs. That file should have this default configuration:
global defaultdir=/var/nfs log=nfslog fhtable=fhtable buffer=nfslog_workbuffer
We will make some changes… first, the “global” is a default tag, and if you configure your exported filesystem with just “log” (instead of log=yourtag), the global tag will be used for logging.
1) The log files will be created on the directory /var/nfs
2) the log files will be: nfslog, fhtable and nfslog_workbuffer
But our example configuration creates a specific tag (yourtag), that we will use instead… just make a copy of that two lines, and change the global word in the copy to yourtag. After that you can customize the directory where the files will be created, and the filenames too. If you use relative names (without the “/” at the beginning), the files will be create relatively to the “defaultdir”. You can specify diferent locations per file using absolute filenames (using the “/” at the beginning).
After that you can restart your NFS services, and you will see that the file /etc/nfs/nfslogtab will be created with your logging configuration, as well as the logging buffer files in the directory you have specified. I think it’s a good idea to have the log files in the same exported filesystem. So, if you have a HA NFS services, the logs will be always there… but it’s your choice!
IMPORTANT: two things to note here is the directive “buffer=” in the file /etc/nfs/nfslog.conf, and the directive “MIN_PROCESSING_SIZE=” in file /etc/default/nfslogd. The first “Specifies the location of the private work buffer file used by the NFS server kernel module to record raw RPC information“, and the second is the “Minimum size buffer should reach before processing“. So, you will see the user readable log files after the first (file), reaches the second (size). You can customize it like you want…again, make your choices!
p.s: The default log file format is basic (compatible with the log format generated by the Washington University FTPd daemon), really, i don’t now why we would want that… but you can choose the extended format, just adding logformat=extended to the file /etc/nfs/nfslog.conf. The extended format has directory modification informations, like: mkdir, rmdir and remove.