The default postgresql.conf file created using initdb contains the following line
#logging_collector = off # Enable capturing of stderr and csvlog
Is there anyway to force initdb itself to generate a file with
logging_collector = on
rather than set options on pg-ctl or edit the generated file.
CodePudding user response:
I keep all the changes in a separate file named custom.conf
Then after initdb
ran, I copy the file to the data directory and append an include
directive to postgresql.conf
:
cp /path/to/dir/custom.conf $PGDATA
echo include = 'custom.conf' >> $PGDATA/postgresql.conf
These steps are easily scriptable, so no manual intervention required.
Alternatively you can skip the copy step and include the config file directly from the central directory. Or you could use include_dir
to include the whole directory where your custom config file is stored.
This has the added benefit (in my opinion) that I have all customizations in a single file. I don't need to go through postgresql.conf
to find settings that are changed from the default.
CodePudding user response:
No, there is no way to do it like that.
But you can modify the file postgresql.conf.sample
in the “share” directory of the PostgreSQL installation, which is used as the blueprint for postgresql.conf
during initdb
.