Default variable details
Some of debops.pgbadger default variables have more extensive configuration
than simple strings or lists, here you can find documentation and examples for
them.
pgbadger__instances
The pgbadger__*_instances variables can be used to manage a set of Bash
scripts stored in the pgbadger__scripts_path directory (by default,
/srv/www/pgbadger/scripts). These scripts will be executed periodically
via cron. Each script can contain pgbadger command(s)
which will generate HTML files with parsed PostgreSQL log output. The Bash
scripts will be executed as the pgbadger__user UNIX account
(pgbadger by default), and will have access to its SSH public keys,
permitting remote command execution.
Configuration entries are managed using the Universal Configuration system.
Examples
Define a Bash script that uses SSH to access remote log files and generates HTML output in the default location:
pgbadger__instances:
- name: 'remote-log'
host: 'db.example.org'
output: 'db.example.org.html'
Use a custom pgBadger command to generate logs from multiple hosts:
pgbadger__instances:
- name: 'multi-log'
raw: |
pgbadger --quiet --start-monday --outfile multi-log.html \
ssh://pgbadger@db1.example.org//var/log/postgresql/*.log \
ssh://pgbadger@db2.example.org//var/log/postgresql/*.log
state: 'present'
Syntax
Configuration entries are defined as YAML dictionaries in a list with specific parameters:
nameRequired. Name of the generated Bash script to manage in the
/srv/www/pgbadger/scripts/directory. Each configuration entry requires an uniquenameparameter, multiple entries with the samenamewill be merged at runtime and will override their parameters in order of appearance.rawString or YAML text block with custom Bash script inserted into a template. The script will be executed in the default output directory (defined in the
pgbadger__www_rootvariable) or the directory specified by thechdirparameter.If the
rawparameter is not used, thehostandoutputparameters are required.raw_headerString or YAML tezt block with custom Bash script inserted into a template. This script will be used to prepare the execution environment for the rest of the pgBadger execution.
If not specified, a boilerplate lock file will be created to prevent repeated execution of the same script.
userOptional. Name of the remote SSH user to use for SSH connection. If not specified,
pgbadger__ssh_uservalue will be used by default.hostFully Qualified Domain Name of the remote host to which pgbadger will SSH to get the contents of the PostgreSQL log files. If the value is
localhost, the script will not use SSH but will check local log files instead.outputName of the HTML file generated by the pgBadger command, should include the
.htmlsuffix to be correctly served by the webserver.chdirOptional. Absolute path to the directory which the generated script will cd into. If not specified, the script will change to the default WWW root directory before executing the pgBadger command(s).
logOptional. Name of the PostgreSQL log file(s) which should be parsed by pgBadger, either on local or remote host. Logs will be searched in the
/var/log/postgresql/directory; the name may contain a star which will be used as a glob pattern. If not specified,*.logvalue will be used by default.commentOptional. String or YAML text block with a comment added at the top of the generated Bash script.
stateOptional. If not specified or
present, a given Bash script will be generated in the/srv/www/pgbadger/scripts/directory. Ifabsent, a given Bash script will be removed from the host. Ifinit, a given configuration entry will be prepared, but it will not be enabled by default; subsequent configuration entry with the samenameandpresentstate can enable a prepared entry. Ifignore, a given configuration entry will be ignored at runtime.