OVHcloud Community

Welcome to your community space. Ask questions, search for information, post content, and interact with other OVHcloud Community members.

Syslog-ng and postgresql connection logs


#1

I would like to send postgres connection logs to the OVH Logs Data Platform service with syslog-ng. How should syslog-ng be configured to send these logs?

Currently I have the following configuration in the ldp.conf file:

source s_postgres {
file("/var/log/postgresql/postgresql-${YEAR}-${MONTH}-${DAY}_000000.log" flags(no-parse));
}

template t_postgres {
template("<${LEVEL_NUM}>1 ${ISODATE} ${HOST} ${PROGRAM} ${PID} - [sdid X-OVH-TOKEN="" pid="${PID}" facility="${FACILITY}" priority="${PRIORITY}"]$
template_escape(no);
}

d_postgres {
tcp(".logs.ovh.com"
port(12201)
tls(ca_dir("/etc/ssl/certs"))
ts_format(“rfc3339”) template(t_postgres)
keep-alive(yes)
so_keepalive(yes)
log-fifo-size(30000)
);
}

log {
source(s_postgres);
destination(d_postgres);
}


#3