Thread: pg_logdir_ls function throwing an error if log_filename name is notdefault

Hi ,

Please refer this small testcase -

Open postgresql.conf file and set -

log_destination = 'stderr'
logging_collector = on
log_directory = 'pg_log1'
log_filename = 'abcd-%Y-%m-%d_%H%M%S.log'

restart the server  , connect   to psql terminal and create adminpack 
extension and fire pg_logdir_ls function

postgres=# create extension adminpack;
CREATE EXTENSION
postgres=# SELECT filename, filetime FROM pg_logdir_ls() AS A(filetime 
timestamp, filename text) ORDER BY filetime ASC;
ERROR:  the log_filename parameter must equal 
'postgresql-%Y-%m-%d_%H%M%S.log'
postgres=#

postgres=# show log_filename ;
       log_filename
-------------------------
  abcd-%Y-%m-%d_%H%M%S.log
(1 row)

postgres=#

Is this an expected , if so - any work around ?

-- 
regards,tushar
EnterpriseDB  https://www.enterprisedb.com/
The Enterprise PostgreSQL Company



Re: pg_logdir_ls function throwing an error if log_filename name isnot default

From
Michael Paquier
Date:
On Wed, Oct 24, 2018 at 08:26:28PM +0530, tushar wrote:
> Is this an expected , if so - any work around ?

That's part of the way pg_logdir_ls_internal() is designed in adminpack
I am afraid as the function internally parses the timestamp from each
file name.
--
Michael

Attachment