NAME¶console-log.conf - Main configuration file for console-log
DESCRIPTION¶console-log keeps logfile pagers open on virtual consoles. /etc/console-log.conf is the configuration file controlling which log file is opened on which tty.
Empty lines and lines starting with "#" are ignored.
The rest of the file consists of stanzas consisting of lines formed as a single keyword and multiple values. Each stanza describes one pager being started. Stanzas are separated with blank lines. Other keywords preceded by $ are interpolated if the other keyword is set in the same stanza _before_ the current line.
- is the number of the tty the log pager should be started on. Choose a tty that has a virtual console. This is a mandatory setting.
- If chvt is yes, the system's console will be switched to the tty of this stanza on startup. Default is no.
- is a list of absolute paths to log files to display. The first file that is either a plain file or a symlink is displayed. The file name must not contain any spaces. This is a mandatory setting.
- user, group
- If user and/or group is/are given, uid/gid will be changed to the given values before invoking the log pager. User needs to be in group in /etc/group. If no user is given, the pager will be run as the default user/group set at build time.
- If the file to be paged exceeds the configured size, no pager is started to avoid memory overflow. Value given in bytes. Default is 7000000. Additionally, ulimit -v is set to twice this value.
- is the absolute path to a bash shell script that will be sourced before the pager is being started. The script will receive the file path as a parameter and can set environment variables that can influence the pager.
- is the actual program that will be invoked to display the file. Currently less is the only pager supported and is therefore also the default. It gets invoked with secure settings and follow mode activated. If you want to use a different pager, you need to manually adapt /usr/share/console-log/logpager. Please submit patches that extend logpager's support for other pagers via the BTS.
EXAMPLE¶The default config file
tty 9 chvt yes file /var/log/syslog group adm tty 8 file /var/log/exim4/mainlog /var/log/exim/mainlog /var/log/mail.log group adm
will start one log pager for the first file found from /var/log/exim4/mainlog, /var/log/exim/mainlog and /var/log/mail.log, and one log pager for /var/log/syslog, and will chvt to tty9.
If a file cannot be read by the user specified in the config file, the init script will complain. You can either change the log file permissions or put the user account in the appropriate group. For example, if /var/log/exim/mainlog is only readable by group mail, you can either change the log file group to adm (make sure to adapt the log file creation/rotation process as well), run the pager as a user that can access the log file, or else put the user account into group mail. Making the file readable for the default account is the preferred way to solve this issue since it introduces the least security risk.
CONFIGURING THE PAGER¶All configuration options are exported and therefore handed down to the logpager script. You can use this to configure your pager. For example, the logpager script set LESSSECURE to the value of the less_lessecure configuration option and LESS to the value off the less_opts configuration option.
This mechanism can be used in any pager extension called from the logpager script.
CONFIGURING THE LESS PAGER¶For configuring the less pager, the following options are implemented:
- controls the value of the LESSSECURE environment variable for the less process. Default is 1
- controls the value of the LESS environment variable for the less process. Default is "--LONG-PROMPT --chop-long-lines --jump-target=10 --max-forw-scroll=100 --window=-4". If you want your pager to automatically re-read the file after possible log rotation (#111272), you might want to add --follow-name to this default. --follow-name might get added to the default in later version.
- controls the value of the LESSKEY environment variable for the less process. Default is /usr/lib/console-log/lesskey, which does not exist in the package currently, and LESSKEY is only set if less_lesskey points to an existing file.
- controls the value of the TERM environment variable for the less process. Default is linux.
SUPPORTING YOUR FAVORITE PAGER¶If you fancy a different pager, please by all means extend the logpager script to support your pager by adding an appropriate part to the case "$PAGER" part of the script. If you want your pager to be configurable via console_log.conf, the convention is to prefix your pager's configuration variables with the name of your pager, e.g. mypager_mycooloption.
Make sure to also make the init script unset each variable that gets used in your logpager patch inside the do_from_config function, or a variable set in a previous console-log.conf stanza will also be set in all following ones until you set a different value.
Please consider submitting your patch for inclusion in the package via the Debian BTS.
BUGS¶Many. Be prepared to debug.
AUTHOR¶This manpage was written by Marc Haber for console-log in Debian/GNU Operating System.
THANKS¶Thanks to Ivan Frederiks for pointing me towards less --follow-name.