Log Files
The server generates several daily log and data files, including:
- Server log files in *.swd/logs
- Alert log files in *.swd/logs
- Journal files in *.swd/journals
- Jobs files in *.swd/data/jobs
- Resources files in *.swd/data/resources
- Taskerload files in *.swd/data/taskerload
- Waitreasons files in *.swd/data/waitreasons
- Checkouts files in *.swd/data/checkouts (this applies only to Monitor)
- Denials files in *.swd/data/denials (this applies only to Monitor)
The files are closed after midnight and a new file is opened for the next day with the appropriate name.
It can be desirable to process the log files as they are being created. The log
handler is a program that reads the log as it is being created. Typically, the log
handler is invoked by substituting two keywords in the command line for the handler:
@LOGFILE@
is the full path of the log file.@EXPIRE@
is the expiration timestamp for the log file, typically midnight of the current day.
A useful log handler is included in VOV, called vovloghandler. The
usage of the log handler:
vovloghandler: This script is an example of a log handler to be used with dailylogs
vovloghandler: It is used to start a process to monitor the logs
vovloghandler: and to process them as they get generated.
vovloghandler: In this example, we use a simple 'tail -f ...'
vovloghandler:
vovloghandler: Usage: vovloghandler @FILENAME@ @EXPIRE@
vovloghandler:
The log handler is executed in the background and it must be able to exit by itself.
Examples of conditions to terminate a log handler:
- The expiration time has been reached.
- A file called
@FILENAME@.closed
;@FILENAME@
is substituted with the full path to the log file.# # This is a fragment of policy.tcl # # Example of flags to control which handlers are called for the log files: # set config(logs,server,handler) "" set config(logs,journals,handler) "" set config(logs,jobs,handler) "vovloghandler @FILENAME@ @EXPIRE@" set config(logs,resources,handler) "" set config(logs,waitreasons,handler) "" set config(logs,checkouts,handler) "vovloghandler @FILENAME@ @EXPIRE@"
Old logs can be cleaned up using vovcleanup.
Compress Log Files
After closing a daily log file, the server can automatically compress the file to
save on disk space. The utility to compress the file is
vovcompresslog, which calls gzip or any other utility to
compress the files.
vovcompresslog: Usage: vovcompresslog <LOGNAME>
To control which log files are compressed, edit the policy.tcl
file and set the
config(log,XXXX,compress)
flags.
Example:#
# This is a fragment of policy.tcl
#
# Example of flags to control which logs get compressed.
#
set config(logs,server,compress) 0
set config(logs,journals,compress) 1
set config(logs,jobs,compress) 0
set config(logs,resources,compress) 1
set config(logs,waitreasons,compress) 0
set config(logs,checkouts,compress) 1
Reopen the Logs After an Error
If the logging encounters an error, such as a full disk, logging will be suspended
and an alert will be issued. After clearing the full disk condition, restart the
logs with the following command:
% vovsh -x 'vtk_server_config reopenlogs 1'