ubclogd

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
SIGNALS
RETURN VALUE
FILES
CAVEATS
SEE ALSO
COPYRIGHT

NAME

ubclogd − utility for periodical logging of selected user beancounters.

SYNOPSIS

ubclogd [-i seconds] [-r kilobytes] [-o logfile] [-n]

ubclogd -h

DESCRIPTION

The purpose of this utility is to log snapshots of some selected user beancounter parameters.

Upon startup, ubclogd checks that it is run under root account, and that /proc/user_beancounters is accessible. It when opens and acquires an exclusive lock on its log file. Then, it tries to grab some disk space by adding blocks of zeroes to the end of file. This space is used to write the log file, so in case of filesystem space shortage log will still be available.

Then it forks a daemon, which task is to periodically wake up and log current values of some user beancounters, reading it from /proc/user_beancounters file. It also maintains free space at the end of file by periodically writing blocks of zeroes to it.

Logged beancounters are: kmemsize, numproc, privvmpages, physpages, and oomguarpages. This list is compiled in and can not be changed from command line.

Log file format is similar to this of /proc/user_beancounters, separated by lines with time stamps.

OPTIONS

-i seconds

Parameters gather interval, in seconds. Default is 60 seconds.

-r kilobytes

Amount of space to reserve for log file, in kilobytes. Default is 512 KB.

-o logfile

Name of log file to write log to. Default is /var/log/ubc.

-n

Do not fork into background.

-h

Outputs a short help message, including compiled in defaults for above command line parameters.

SIGNALS

Below is the list of signals for which ubclogd has a special handlers.
SIGUSR1

Upon receiving the signal, extra space in log file is truncated, and ubclogd enters "do not maintain extra space" mode. This can be used either before rotating ubclogd’s log file, or before stopping it, if you do not want to have many zero-filled blocks at end of file.

SIGHUP

Makes ubclogd to reopen its log file, and restore "maintain extra space" mode. This is used after log rotation.

RETURN VALUE

Returns 0 upon success. If some operation before forking into background failed, returns 1.

FILES

/proc/user_beancounters, /var/log/ubc.

CAVEATS

It is not convenient to read the log file, because it contains a lot of null characters at the end. This is the price you have to pay for ubclogd ability to reserve free space.

Log rotating is a bit complex: you have to send SIGUSR1 to process, when rename its log file, and at last send SIGHUP.

SEE ALSO

kill(1).

COPYRIGHT

Copyright (c) 1999-2015 Parallels IP Holdings GmbH. All rights reserved.