C o m m a n d U s a g e L o g g i n g ccccccccccccccccccccccccccccccccccccccc Introduction ------------ This distribution provides the 'upacct' command which copies selected process accounting data into a file format that records per-host command usage: The logs from multiple machines can be merged to create a site-wide log. typedef struct uacct { time_t ac_btime; /* Beginning time */ comp_t ac_etime; /* acctng elapsed time in clock ticks */ char ac_comm[8]; /* command name */ struct in_addr addr; /* host address */ struct uacct *next; } uacct; Commands similar to 'lastcomm' display per-user or per-command information from 'upacct' format files. Example Usage ------------- At our site the following lines have been added to 'runnact' - the nightly accounting script - to create 'upacct' files and forward them to a host designated as the accounting "server". ------------------------ /usr/lib/acct/runacct ----------------------------- # "any installation dependant accounting programs should be run here" ADM_SVR=venus # Send user data from the switched pacct file(s) to the server. cd ${_adm} upacct ucmds.${_date}.`hostname` -p Spacct*.${_date} 2>&1 > /dev/null rcp ucmds.${_date}.`hostname` ${ADM_SVR}:/usr/local/adm/acct/users/ucmds.${_da te}.`hostname` 2>&1 > /dev/null rm -f ucmds.${_date}.`hostname` ------------------------------------------------------------------------------ A Cron job to merge the per-host 'upacct' files is run nightly on the accounting server: The directory of merged 'upacct' files is NFS exported for access by selected groups of users. Contents of the Distribution ---------------------------- Makefile - commands.1 - Man page: customise according to your sites policy upacct.c - Source code for the 'upacct' command. showcomm.c - Source code for programs 'showcomm' and 'whocomm' getcmd.c which display information from 'upacct' format files. acctuser.sh - Cron script for merging 'upacct' files. ucomm.sh - example scripts to display per user wcomm.sh and per command information from 'upacct' file directory. Building -------- Type "make" from the source directory. Note that the hash define USER_UIDS in the source file upacct.c is used to identify special user ID which will be ignored when data is gathered. You might want to log the activity of such users; but doing so will considerably increase the size of the log files 26/01/96