talas-group/04_INFRA_DEPLOIEMENT/Ansible/roles/pgbadger
senke 66471934af Initial commit: Talas Group project management & documentation
Knowledge base of ~80+ markdown files across 14 domains (00-13),
Logseq graph, hardware design files (KiCAD), infrastructure configs,
and talas-wiki static site.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 20:10:41 +02:00
..
defaults Initial commit: Talas Group project management & documentation 2026-04-04 20:10:41 +02:00
files Initial commit: Talas Group project management & documentation 2026-04-04 20:10:41 +02:00
meta Initial commit: Talas Group project management & documentation 2026-04-04 20:10:41 +02:00
tasks Initial commit: Talas Group project management & documentation 2026-04-04 20:10:41 +02:00
templates Initial commit: Talas Group project management & documentation 2026-04-04 20:10:41 +02:00
readme.md Initial commit: Talas Group project management & documentation 2026-04-04 20:10:41 +02:00

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 ``