pgbadger

By default, this role just installs the pgbadger binary via the official postgresql Debian repository.

You can also automate an incremental report by setting this variable to true:

pgbadger_auto_run: true

You can expose the logs and reports via HTTP by setting this variable to true:

pgbadger_web_access: true

If you set pgbadger_web_access to true, you can also add custom HTTPD configurations in multiline format by setting this variable:

pgbadger_httpd_raw_config: |
  <Location />
      IndexIgnore *.log pgbadger_auto_report
      IndexOptions +FancyIndexing
      AuthBasicProvider       ldap
      AuthType                Basic
      AuthName                "Cosium authentication"
      AuthLDAPURL             "ldaps://ldapx.cosium.com ldap.cosium.com/dc=cosium,dc=com?uid?sub?(&(objectClass=CosAccount)(CosStatus=active))"
      AuthLDAPBindDN          "uid={{ ansible_hostname }},ou=servers,dc=cosium,dc=com"
      AuthLDAPBindPassword    "{{ ldappass }}"
      AuthLDAPGroupAttribute          memberUid
      AuthLDAPGroupAttributeIsDN      off
      Require ldap-group cn=sysop,ou=system,ou=groups,dc=cosium,dc=com
      Require ldap-group cn=Infrastructure,ou=divisions,ou=groups,dc=cosium,dc=com
      Require ldap-group cn=prodaccess,ou=system,ou=groups,dc=cosium,dc=com
  </Location>

If set to true, this role will look for the following variables as default for the input directory (where the csv logs are):

pgbadger_auto_analyze_directory_in: "{{ pg_log_directory | default(patroni_pg_log_directory, true) | default('/var/log/postgresql') }}"

The variable pgbadger_auto_analyze_directory_in is set using the command psql -Atc SHOW log_directory directly on the local database.

For the output directory :

pgbadger_auto_analyze_directory_out: "{{ pgbadger_auto_analyze_directory_in }}/pgbadger_auto_report"

Optional variables for automatic mode

Variable Description Type of variable Default value
pgbadger_reports_retention_weeks The number of weeks to retain the generated reports integer 4
pgbadger_auto_hour_range The cron expression used to run the crontab for the `hour' part string 9-19
pgbadger_web_access Whether to install httpd on the host to expose the logs via HTTP boolean false
pgbadger_httpd_raw_config Allows adding custom HTTPD configurations in multiline format. Requires pgbadger_web_access. string ``