0

I have edited the postgresql.conf file and set logging parameters as follows. However, after I restart and look a the logging_collector value, it's set to off and logging is not working:

log_destination = 'csvlog'
logging_collector = on
log_directory = 'log'
log_filename = 'postgresql-%Y-%m-%d.log'
log_rotation_age = 1d
log_rotation_size = 100MB
log_truncate_on_rotation = on

select * from pg_settings where name like 'log%'
"log_autovacuum_min_duration"   "-1"
"log_checkpoints"   "off"
"log_connections"   "on"
"log_destination"   "csvlog"
"log_directory" "log"
"log_disconnections"    "off"
"log_duration"  "off"
"log_error_verbosity"   "default"
"log_executor_stats"    "off"
"log_file_mode" "0640"
"log_filename"  "postgresql-%Y-%m-%d.log"
"log_hostname"  "off"
"log_line_prefix"   "%m [%p] "
"log_lock_waits"    "off"
"log_min_duration_sample"   "-1"
"log_min_duration_statement"    "-1"
"log_min_error_statement"   "error"
"log_min_messages"  "warning"
"log_parameter_max_length"  "-1"
"log_parameter_max_length_on_error" "0"
"log_parser_stats"  "off"
"log_planner_stats" "off"
"log_recovery_conflict_waits"   "off"
"log_replication_commands"  "off"
"log_rotation_age"  "1440"
"log_rotation_size" "102400"
"log_statement" "none"
"log_statement_sample_rate" "1"
"log_statement_stats"   "off"
"log_temp_files"    "-1"
"log_timezone"  "America/Chicago"
"log_transaction_sample_rate"   "0"
"log_truncate_on_rotation"  "on"
**"logging_collector"   "off"**
"logical_decoding_work_mem" "65536"
0

1 Answer 1

1

Either you edited the wrong file, or you restarted the wrong server, or the setting is overridden somewhere else. You got the right idea by looking at pg_settings, but you looked at the wrong columns:

SELECT setting, source, sourcefile, sourceline, pending_restart
FROM pg_settings
WHERE name = 'logging_collector';
1
  • 1
    I feel like an idiot, there was a line lower in my config file that turned it off, so you were definitely correct. My mistake, thanks! Commented Jun 2, 2023 at 14:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.