Rsyslog site configuration

rsyslog configuration files are created upon site configuration, through invocation of the site-configure command.

This can be enabled through site settings by defining a rsyslog key, e.g.:

settings.yaml
 rsyslog: {}

Note

See settings schema for further information about available configuration and their model.

The base rsyslog configuration is installed site-wise from a template (which may be overridden).

The default rsyslog configuration template provided by pglift assumes the syslog_ident is set to postgresql-{version}-{name} (on the postgresql.conf template). With the default template, logs are routed on the programname which is equivalent to syslog_ident value.

This default template file contains:

postgresql/rsyslog.conf
$umask 0027
$FileCreateMode 0640
$FileOwner {user}
$FileGroup {group}
template (name="pglift_postgresql_template" type="string" string="{logpath}/%PROGRAMNAME%.log")
if (re_match($programname, "postgresql-.*")) then -?pglift_postgresql_template
&stop

And the default PostgreSQL configuration template file used to automatically adjust the syslog_ident and the log_destination looks like this:

postgresql/postgresql-rsyslog.conf
log_destination = 'syslog'
syslog_ident = 'postgresql-{version}-{name}'

pglift users can always adapt those values (syslog_ident and rsyslog routing rule based on programname), but they will have to override both configuration templates (postgresql and rsyslog).

To use this plugin, it’s also required to set the log_destination to syslog, otherwise PostgreSQL will not send the log to the syslog server. This configuration item is configured with the correct value when using the postgresql and rsyslog default templates provided by pglift.

Running rsyslog is not handled by pglift, one may include pglift rsyslog directory given by pglift site-settings -o json | jq '.rsyslog.configdir in the global rsyslog configuration.