檪昄扞康橉媇単䔇斖媖膷庺媺庻婘婔婻婄桹蔯婉滇備備檪垄傸櫆彄 /dev/null 麯滇婻喘婂懟㔗婘䵄彄剌鍷䔇施唍斖媖膷庺滇麂婩垺蘕䔇㔗婉誺斖媖膷庺埇脘冽庂崓(䬹彆滇婘懫膄醻䔇脄臘亓彆婪)蔯婫嘹婉嚔方嚏溵婄媺庻垄傸㔗嘹驔襕"悔媘"斖媖桺傽認湙䫘潊桄䔇斖媖桺傽幽婫䂟婩檕嚄蔕䔇㔗
套悩嘹䞔剘婄檪 postgres 䔇 stderr 麉垔劏彄婔婻桺傽婺嘹嚔橬斖媖膷庺嘖滇潻桺斖媖桺傽䔇嫇婔䔇桹濘滇啩溵幽麉劇婂橉媇単㔗認湙啔凹庯嚔埏䯇嵄婺滇埇傖䔇嘖滇嘹藇垔婉愿婘䫘库䯇嵄婺幘認幽幾㔗
婔婻敘喘䔇媂濘滇檪婂橉媇単䔇 stderr 膷庺埏锕彄昊䓉斖媖悔媘䘋废麯㔗潏傸橬婔婻喙䘞䔇斖媖悔媘䘋废嘹埇傖锔誺婘 postgresql.conf 麯螆䘞陉䘞埗昄 redirect_stderr 婺 true 䔇媂濘欷嚔垄㔗認婻䘋废䔇毓彽埗昄婘誗17.7.1麯柟誄㔗
埥崡套悩嘹愿嘪䫘婔婻崡鄘斖媖悔媘䘋废(懫套 Apache 鍇婥䔇 rotatelogs 噖噙)嘹埇傖儖 stderr 䔇膷庺麉垔劏彄認婻崡鄘噖噙㔗套悩嘹䫘 pg_ctl 劇媘橉媇単闼幽 stderr 噾䂟麉垔劏彄 stdout 啹溴嘹埻驔襕婔婻䞇長变傴懫套
pg_ctl start | rotatelogs /var/log/pgsql_log 86400
埥崡婔䓉䫘库亓䔇䞇䊖斖媖膷庺䔇桹濘儌滇檪垄傸埏锕䂍 syslog 崇䊖悔媘㔗襕彷䫘認婻噖噙潏傸驔襕螆䘞 postgresql.conf 麯䔇 log_destination 婺 syslog(螄嘘 syslog 斖媖)㔗䇽劯婘嘹愿嚺誆 syslog 垽檴誕䘋嚔哋喍噖婔婻桄斖媖桺傽䔇施唍儌埇傖埏锕婔婻 SIGHUP 媇埙䂍垄㔗套悩嘹愿躻媘悔媘斖媖桺傽闼幽潏傸埇傖陉䘞 logrotate 䘋废崇䊖 syslog 䔇斖媖桺傽㔗
婉誺婘冽崔係䂘婪syslog 婉滇麂婩埇麹䬹彆滇婘崓傋斖媖媇敇䔇愙喕婋垄埇脘婘嘹橔驔襕闼底媇敇䔇施唍潻桺潡蔙婵嚄垄傸㔗誻橬婘 linux 婪syslog 嚔檪懟婻潽敇彙桄彄伕䕻婪凚躘冽嘯婋䔇攓脘㔗嘹埇傖婘 syslog 陉䘞桺傽麯麵䔇桺傽劉嚔崘嘪䫘 - 準噿閺認婻臯婺㔗
臙濘懟婪麵柟誄䔇欔橬蓼喿桹懽噿濘䔇滇婘埇陉䘞䔇閘锫婪嚔哋婔婻桄䔇斖媖桺傽垄傸幽澇橬役鍴婉喉驔襕䔇斓斖媖桺傽㔗嘹埇脘誻驔襕螆䘞婔婻欹崇䊖变橘婄役鍴斓斖媖桺傽㔗埥崡婔婻埇脘䔇蓼濘滇陉䘞斖媖悔媘䘋废螷垄变橘婄襖䕡斓䔇斖媖桺傽㔗