mirror of
https://github.com/rsyslog/rsyslog.git
synced 2025-12-11 05:00:41 +01:00
Happy new years! Add another action parameter `conninfo` that allows specifying a postgres connection string. This enables us to use any of the postgres connection parameters, particularly `sslmode` and `sslrootcert`. Per the postgres docs, this connection string can be a URI or several key-value pairs. https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING Here's an example: ``` module(load="ompgsql") action( type="ompgsql" conninfo="postgresql://postgres:password@localhost/Syslog?sslmode=require" ) ``` This addresses https://github.com/rsyslog/rsyslog/issues/4741 by allowing the user to specify ssl options as part of the connection string. `libpq` will take care of the rest. This also addresses https://github.com/rsyslog/rsyslog/issues/4698 because `libpq` is not constrained by MAXHOSTNAMELEN. Long hostnames will work. `conninfo` can be specified in lieu of the other parameters. `ompgsql` will prioritize using `conninfo` to connect over the other parameters. Signed-off-by: Ameer Ghani <inahga@gmail.com>
28 lines
681 B
Bash
Executable File
28 lines
681 B
Bash
Executable File
#!/bin/bash
|
|
# This file is part of the rsyslog project, released under GPLv3
|
|
|
|
. ${srcdir:=.}/diag.sh init
|
|
|
|
psql -h localhost -U postgres -f testsuites/pgsql-basic.sql
|
|
|
|
generate_conf
|
|
add_conf '
|
|
module(load="../plugins/ompgsql/.libs/ompgsql")
|
|
if $msg contains "msgnum" then {
|
|
action(type="ompgsql"
|
|
conninfo="postgresql://postgres:testbench@localhost/syslogtest")
|
|
}'
|
|
startup_vg
|
|
injectmsg 0 5000
|
|
shutdown_when_empty
|
|
wait_shutdown_vg
|
|
check_exit_vg
|
|
|
|
psql -h localhost -U postgres -d syslogtest -f testsuites/pgsql-select-msg.sql -t -A >$RSYSLOG_OUT_LOG
|
|
seq_check 0 4999
|
|
|
|
echo cleaning up test database
|
|
psql -h localhost -U postgres -c 'DROP DATABASE IF EXISTS syslogtest;'
|
|
|
|
exit_test
|