From 498f4d42ce68db0d3cc607b0b7e1be697a86e207 Mon Sep 17 00:00:00 2001 From: jacksonfoz Date: Wed, 14 Jul 2021 11:55:16 -0300 Subject: [PATCH 1/2] Handle relative log_directory and csvlog Add support on logfile action for relative log_directory (i.e: '../pg_log') and csvlog log_destination. --- check_postgres.pl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/check_postgres.pl b/check_postgres.pl index ba28f27..ecf7b0b 100755 --- a/check_postgres.pl +++ b/check_postgres.pl @@ -6125,7 +6125,7 @@ sub check_logfile { $SQL = q{ SELECT name, CASE WHEN length(setting)<1 THEN '?' ELSE setting END AS s FROM pg_settings -WHERE name IN ('log_destination','log_directory','log_filename','redirect_stderr','syslog_facility') +WHERE name IN ('log_destination','log_directory','log_filename','redirect_stderr','syslog_facility','data_directory') ORDER BY name }; @@ -6171,6 +6171,10 @@ sub check_logfile { ndie msg('logfile-stderr'); } } + elseif ($i->{log_destination} eq 'csvlog') { + $logfile = "$i->{'data_directory'}/$i->{log_directory}/$i->{log_filename}"; + $logfile =~ s/\.log$/\.csv/; + } } ## We now have a logfile (or a template)..parse it into pieces. From 91f7d407bb0e5627d6281b28f8ecfa1a0e6ff24d Mon Sep 17 00:00:00 2001 From: jacksonfoz Date: Mon, 4 Sep 2023 11:51:27 -0300 Subject: [PATCH 2/2] Update check_postgres.pl --- check_postgres.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check_postgres.pl b/check_postgres.pl index ecf7b0b..67cb2c2 100755 --- a/check_postgres.pl +++ b/check_postgres.pl @@ -6171,7 +6171,7 @@ sub check_logfile { ndie msg('logfile-stderr'); } } - elseif ($i->{log_destination} eq 'csvlog') { + elsif ($i->{log_destination} eq 'csvlog') { $logfile = "$i->{'data_directory'}/$i->{log_directory}/$i->{log_filename}"; $logfile =~ s/\.log$/\.csv/; }