Managing NFS and NIS, 2nd Edition - Mike Eisler [226]
sales log=/export/logs/nfslog fhtable=sales-table
corp log=/export/logs/nfslog fhtable=corp-table
eng log=/export/logs/eng/englog
Excerpt from /etc/default/nfslogd:
MAX_LOGS_PRESERVE=10
Both the sales and corp tags send the final log records to /export/logs/nfslog. The eng tag sends the log records to /export/logs/eng/nfslog. You will have a total of up to 10 log files named nfslog, nfslog.0, ..., nfslog.9 in /export/logs. Similarly, you will have a total of up to ten log files named englog, englog.0, ..., englog.9 in /export/logs/eng. Notice that the fact that two tags use the same log file does not affect the total number of logs preserved.
CYCLE_FREQUENCY
Specifies the frequency with which log files are cycled (see MAX_LOGS_PRESERVE). The value is specified in hours. This helps keep the log file size manageable. The default is to cycle every 24 hours.
MAPPING_UPDATE_INTERVAL
Specifies the time interval, in seconds, between updates of the records in the filehandle mapping table. Ideally the access time of entries queried in the mapping table should be updated on every access. In practice, updates of this table are much more expensive than queries. Instead of updating the access time of a record each time the record is accessed, the access time is updated only when the last update is older than MAPPING_UPDATE_INTERVAL seconds. By default updates are performed once per day. Make sure this value is always less than the value specified by PRUNE_TIMEOUT, otherwise all of the entries in the filehandle mapping tables will be considered timed out.
PRUNE_TIMEOUT
Specifies how frequent the pruning of the filehandle mapping tables is invoked. This value represents the minimum number of hours that a record is guaranteed to remain in the mapping table. The default value of seven days (168 hours) instructs the nfslogd daemon to perform the database pruning every seven days and remove the records that are older than seven days. Note that filehandles can remain in the database for up to 14 days. This can occur when a record is created immediately after the pruning process has finished. Seven days later the record will not be pruned because it is only six days and hours old. The record will be removed until the next pruning cycle, assuming no client accesses the filehandle within that time. The MAPPING_UPDATE_INTERVAL may need to be updated accordingly.
Disabling NFS server logging
Unfortunately, disabling logging requires some manual cleanup. Unsharing or resharing a filesystem without the -o log directive stops the kernel from storing information into the work buffer file. You must allow the nfslogd daemon enough time to process the work buffer file before shutting it down. The daemon will notice that it needs to process the work buffer file once it wakes up after its IDLE_TIME has been exceeded.
Once the work buffer file has been processed and removed by the nfslogd daemon, the nfslogd daemon can manually be shutdown by sending it a SIGHUP signal. This allows the daemon to flush the pending NFS log information before it is stopped. Sending any other type of signal may cause the daemon to be unable to flush the last few records to the log.
There is no way to distinguish between a graceful server shutdown and the case when logging is being completely disabled. For this reason, the mapping tables are not removed when the filesystem is unshared, or the daemon is stopped. The system administrator needs to remove the filehandle mapping tables manually when he/she wants to reclaim the filesystem space and knows that logging is being permanently disabled for this filesystem.[5]
* * *
[3] UFS logging is the process of storing transactions (changes that make up a complete UFS operation) in a log before the transactions are applied to the filesystem. Once a transaction is stored, it can be later applied to the filesystem. This prevents filesystems from becoming inconsistent, eliminating the need to run fsck.
[4] See dbm_clearerr(3C).
[5] Keep in mind that if logging is later reenabled,