11. Accounting Database

Rush accounting database is stored in the directory ‘localstatedir/rush’, where localstatedir stands for the name of the local state directory, defined at compile time. By default, it is ‘prefix/var’, where prefix is the installation prefix, which defaults to ‘/usr/local’. Thus, the default database directory is ‘/usr/local/var/rush’. You can change this default by using ‘--localstatedir’ option to configure before compiling the package. The ‘--prefix’ option affects it as well.

As of version 1.6, the database consists of two files, called ‘utmp’ and ‘wtmp’. The ‘wtmp’ file keeps information about all user sessions, both finished and still active. The ‘utmp’ file contains indices to those records in ‘wtmp’, which represent active sessions.

The ‘wtmp’ grows continuously, while ‘utmp’ normally grows the first day or two after enabling accounting mode, and from then on its size remains without changes. If you set up log file rotation, e.g. by using logrotate (see (logrotate(8))logrotate section `logrotate' in logrotate man page), or a similar tool, it is safe to rotate ‘wtmp’ without notifying rush. The only requirement is to truncate ‘utmp’ to zero size after rotating ‘wtmp’, as shown in the following ‘logrotate.conf’ snippet:

 
/var/run/rush/wtmp {
    monthly
    create 0640 root svusers
    postrotate
      cat /dev/null > /var/run/rush/utmp
    endscript
}

The following sections contain a detailed description of the structure of these two files. You may skip them, if you are not interested in technical details.