欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

怎么在Postgresql數(shù)據(jù)庫中對日志進(jìn)行配置-創(chuàng)新互聯(lián)

這期內(nèi)容當(dāng)中小編將會給大家?guī)碛嘘P(guān)怎么在Postgresql數(shù)據(jù)庫中對日志進(jìn)行配置,文章內(nèi)容豐富且以專業(yè)的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。

攀枝花網(wǎng)站制作公司哪家好,找創(chuàng)新互聯(lián)建站!從網(wǎng)頁設(shè)計(jì)、網(wǎng)站建設(shè)、微信開發(fā)、APP開發(fā)、響應(yīng)式網(wǎng)站開發(fā)等網(wǎng)站項(xiàng)目制作,到程序開發(fā),運(yùn)營維護(hù)。創(chuàng)新互聯(lián)建站2013年至今到現(xiàn)在10年的時間,我們擁有了豐富的建站經(jīng)驗(yàn)和運(yùn)維經(jīng)驗(yàn),來保證我們的工作的順利進(jìn)行。專注于網(wǎng)站建設(shè)就選創(chuàng)新互聯(lián)建站。

配置詳解

配置文件:postgresql.conf

配置1:日志開啟與關(guān)閉

默認(rèn)為off,設(shè)置為on則pg可以記錄相關(guān)日志,建議打開,否則在數(shù)據(jù)庫出現(xiàn)異常時候,沒有日志來定位具體問題

# This is used when logging to stderr:
logging_collector =on# Enable capturing of stderr and csvlog
# into log files. Required to be on for
# csvlogs.
# (change requires restart)

配置2:日志滾動策略

# These are only used if logging_collector is on:

#配置日志目錄,默認(rèn)為pg_log即可

log_directory = 'pg_log' # directory where log files are written,

# can be absolute or relative to PGDATA

#pg日志文件名及其擴(kuò)展名,默認(rèn)即可

log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # log file name pattern,

# can include strftime() escapes

#pg日志文件的權(quán)限,默認(rèn)即可

log_file_mode = 0600 # creation mode for log files,

#開啟日志滾動階段,這里需要設(shè)置為on

log_truncate_on_rotation =on# If on, an existing log file with the

#日志保留天數(shù),這里看實(shí)際環(huán)境,如果是測試建議1d,如果是生產(chǎn)環(huán)境建議7d

log_rotation_age = 1d # Automatic rotation of logfiles will

#單個日志大小,默認(rèn)100MB即可,比較標(biāo)準(zhǔn)的配置

配置3:日志打印時機(jī)

#發(fā)送給客戶端的消息級別,建議warning即可,日志等級越低,打印的內(nèi)容越多,性能上越有損耗
client_min_messages = warning # values in order of decreasing detail:
# debug5
# debug4
# debug3
# debug2
# debug1
# log
# notice
# warning
# error
#寫到數(shù)據(jù)庫日志文件中的消息的級別,建議warning即可,日志等級越低,打印的內(nèi)容越多,性能上越有損耗
log_min_messages = warning # values in order of decreasing detail:
# debug5
# debug4
# debug3
# debug2
# debug1
# info
# notice
# warning
# error
# log
# fatal
# panic
#是否記錄導(dǎo)致數(shù)據(jù)庫出現(xiàn)錯誤的SQL語句,建議warning即可,日志等級越低,打印的內(nèi)容越多,性能上越有損耗
log_min_error_statement = error # values in order of decreasing detail:
# debug5
# debug4
# debug3
# debug2
# debug1
# info
# notice
# warning
# error
# log
# fatal
# panic (effectively off)

配置4:數(shù)據(jù)庫統(tǒng)計(jì)監(jiān)控

#log_statement_stats為on則會開啟log_parser_stats,log_planner_stats,log_executor_stats這三個選項(xiàng),生產(chǎn)環(huán)境不建議開啟,建議測試環(huán)境開啟,用于定位問題。
#log_parser_stats = off
#log_planner_stats = off
#log_executor_stats = off
#log_statement_stats = off

配置5:慢sql記錄配置

#執(zhí)行sql時間為2s以上的sql都會被記錄下來
log_min_duration_statement = 2s

以上配置再修改完之后,均需要重啟pg生效。

上述就是小編為大家分享的怎么在Postgresql數(shù)據(jù)庫中對日志進(jìn)行配置了,如果剛好有類似的疑惑,不妨參照上述分析進(jìn)行理解。如果想知道更多相關(guān)知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。

當(dāng)前標(biāo)題:怎么在Postgresql數(shù)據(jù)庫中對日志進(jìn)行配置-創(chuàng)新互聯(lián)
瀏覽路徑:http://chinadenli.net/article12/deeggc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站建設(shè)網(wǎng)站收錄、品牌網(wǎng)站設(shè)計(jì)、網(wǎng)站內(nèi)鏈定制網(wǎng)站、服務(wù)器托管

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都定制網(wǎng)站網(wǎng)頁設(shè)計(jì)