{"Entry":{"collection":"guc","key":"log_destination","name":"log_destination","aliases":[],"metadata":{"baseline":false,"boot_human":"Not specified","boot_val":null,"category":"Reporting and Logging / Where to Log","category_zh":"","changed_in":["15"],"changes":[{"documentation_changed":false,"fields":{},"from":"7.4","status":"added","to":"8.0"},{"documentation_changed":true,"fields":{},"from":"8.0","status":"changed","to":"8.1"},{"documentation_changed":true,"fields":{},"from":"8.1","status":"changed","to":"8.2"},{"documentation_changed":true,"fields":{},"from":"8.2","status":"changed","to":"8.3"},{"documentation_changed":true,"fields":{},"from":"8.4","status":"changed","to":"9.0"},{"documentation_changed":true,"fields":{},"from":"9.0","status":"changed","to":"9.1"},{"documentation_changed":true,"fields":{},"from":"9.1","status":"changed","to":"9.2"},{"documentation_changed":true,"fields":{},"from":"9.5","status":"changed","to":"9.6"},{"documentation_changed":true,"fields":{},"from":"9.6","status":"changed","to":"10"},{"documentation_changed":true,"fields":{},"from":"11","status":"changed","to":"12"},{"documentation_changed":true,"fields":{},"from":"13","status":"changed","to":"14"},{"documentation_changed":true,"fields":{"extra_desc":{"from":"Valid values are combinations of \"stderr\", \"syslog\", \"csvlog\", and \"eventlog\", depending on the platform.","to":"Valid values are combinations of \"stderr\", \"syslog\", \"csvlog\", \"jsonlog\", and \"eventlog\", depending on the platform."}},"from":"14","status":"changed","to":"15"},{"documentation_changed":true,"fields":{},"from":"16","status":"changed","to":"17"},{"documentation_changed":true,"fields":{},"from":"17","status":"changed","to":"18"}],"content_hash":"745c0b36faaf3006e61cf0653426e52bd4a1ea6b660f8ad7794122a5cd1fbd07","context":"","default_changed_in":[],"default_history":[{"from":"9.0","to":"19","value":"stderr"}],"derived_content_hash":"6c17a3f9d79137ab6ac51fa06eed346af04898cf21e054ae00fcb7b778995405","documentation_refresh":{"batch":"20261113","original_source_rev":"wiki-repair-20261023:7e76ee9d164ebe1de91d59012f4bb4f911d1e2636a7ba4e4f8577178cd8bd20f","versions":{"14":"14.25","15":"15.20","16":"16.16","17":"17.12","18":"18.7","19":"19rc2"}},"editorial":{"advice":{"olap":"Size the log_destination path for bursty analytical output and verify that rotation or downstream ingestion cannot stall database processes.","oltp":"Set log_destination as part of one end-to-end logging design. Validate collector behavior, rotation, ownership, shipping, retention, and recovery from a full destination.","small":"Use a bounded, easily rotated log_destination configuration and monitor free space; a small node should not retain redundant formats or unlimited files."},"mechanism":["log_destination sets the destination for server log output. Valid values are combinations of \"stderr\", \"syslog\", \"csvlog\", \"jsonlog\", and \"eventlog\", depending on the platform. Several destinations can be active at once; csvlog and jsonlog require logging_collector, while stderr, syslog, and Windows eventlog follow different transport paths.","log_destination is a SIGHUP-context setting: a configuration reload activates the new server value without a restart; subsequent operations that consult it use the refreshed value.","The active path is composed from log_destination, logging_collector or syslog/eventlog, file naming and permissions, rotation triggers, and external shipping or retention."],"pitfalls":["Editing log_destination without reloading configuration and verifying the effective value and subsequent behavior.","Combining incompatible destination, collector, filename, and rotation assumptions and then losing or overwriting logs.","Failing to monitor a full or unwritable log target, which can block logging or database activity depending on the path.","Changing log_destination globally without a rollback plan and a client or operational compatibility test."],"references":[{"title":"PostgreSQL 19 Beta 4: log_destination","url":"https://www.postgresql.org/docs/19/runtime-config-logging.html#GUC-LOG-DESTINATION"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["logging_collector","log_directory","log_filename","log_rotation_age","log_rotation_size"],"summary":"log_destination is the PostgreSQL setting that defines the destination for server log output."},"enumvals":[],"first_version":"8.0","group":"Reporting and Logging","group_slug":"logging","imported_at":"2026-09-30T00:40:57.297061+08:00","intro_commit":{},"key":"log_destination","last_version":"20","max_val":"","min_val":"","name":"log_destination","position":221,"present_in":["8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"repair_provenance":{"original_source_revision":"english-manuals:06312c0c4bc6ca061dccd3da987d5b1f13ae10b9268f240d0263cb26723dfb94","receipt_sha256":"c05c2a5bc3e0b51cae12aeb01bb0ceec5b0e43880f60a00f98e36dec97f39346","repair":"wiki-repair-20261023"},"short_desc":"PostgreSQL supports several methods for logging server messages, including stderr, csvlog, jsonlog, and syslog.","short_desc_zh":"","source_rev":"wiki-repair-20261023:7e76ee9d164ebe1de91d59012f4bb4f911d1e2636a7ba4e4f8577178cd8bd20f","unit":"","vartype":"string"}},"Definition":{"Collection":"guc","Key":"log_destination","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"log_destination","SourceRevision":"wiki-repair-20261023:7e76ee9d164ebe1de91d59012f4bb4f911d1e2636a7ba4e4f8577178cd8bd20f","Facts":{"boot_val":"stderr","category":"Reporting and Logging / Where to Log","context":"sighup","description":"PostgreSQL supports several methods for logging server messages, including stderr, csvlog, jsonlog, and syslog. On Windows, eventlog is also supported. Set this parameter to a list of desired log destinations separated by commas. The default is to log to stderr only. This parameter can only be set in the postgresql.conf file or on the server command line. If csvlog is included in log_destination, log entries are output in “comma-separated value” (CSV) format, which is convenient for loading logs into programs. See Section 19.8.4 for details. logging_collector must be enabled to generate CSV-format log output. If jsonlog is included in log_destination, log entries are output in JSON format, which is convenient for loading logs into programs. See Section 19.8.5 for details. logging_collector must be enabled to generate JSON-format log output. When either stderr, csvlog or jsonlog are included, the file current_logfiles is created to record the location of the log file(s) currently in use by the logging collector and the associated logging destination. This provides a convenient way to find the logs currently in use by the instance. Here is an example of this file's content: stderr log/postgresql.log csvlog log/postgresql.csv jsonlog log/postgresql.json current_logfiles is recreated when a new log file is created as an effect of rotation, and when log_destination is reloaded. It is removed when none of stderr, csvlog or jsonlog are included in log_destination, and when the logging collector is disabled. Note On most Unix systems, you will need to alter the configuration of your system's syslog daemon in order to make use of the syslog option for log_destination. PostgreSQL can log to syslog facilities LOCAL0 through LOCAL7 (see syslog_facility), but the default syslog configuration on most platforms will discard all such messages. You will need to add something like: local0.* /var/log/postgresql to the syslog daemon's configuration file to make it work. On Windows, when you use the eventlog option for log_destination, you should register an event source and its library with the operating system so that the Windows Event Viewer can display event log messages cleanly. See Section 18.12 for details.","description_zh":"PostgreSQL 支持多种记录服务器消息的方法，包括 stderr，csvlog，jsonlog 和 syslog。在 Windows 上，eventlog 也受支持。将此参数设置为以逗号分隔的所需日志目的地列表。默认情况下仅记录到 stderr。此参数只能在 postgresql.conf 文件或服务器命令行中设置。 如果 csvlog 被包括在 log_destination 中，日志项会以“逗号分隔值”（CSV）格式被输出，这样可以很方便地把日志载入到程序中。详见第 19.8.4 节。要产生 CSV 格式的日志输出，必须启用 logging_collector。 如果 jsonlog 包含在 log_destination 中，日志条目将以 JSON 格式输出，这对将日志加载到程序中很方便。有关详细信息，请参见第 19.8.5 节。必须启用 logging_collector 才能生成 JSON 格式的日志输出。 当包含 stderr、csvlog 或 jsonlog 时，文件 current_logfiles 会被创建，记录日志收集器当前使用的日志文件位置和相关的日志目的地。这提供了一种方便的方式来查找实例当前使用的日志。以下是该文件内容的示例： stderr log/postgresql.log csvlog log/postgresql.csv jsonlog log/postgresql.json 当由于轮换而创建新的日志文件时，以及重新加载 log_destination 时，current_logfiles 会被重新创建。当 log_destination 中不包含 stderr、csvlog 或 jsonlog，或者日志收集器被禁用时，它会被移除。 注意 在大多数 Unix 系统上，你将需要修改系统的 syslog 守护进程的配置来使用 log_destination 的 syslog 选项。PostgreSQL 可以在 syslog 设施 LOCAL0 到 LOCAL7 中记录（见 syslog_facility），但是大部分平台上的默认 syslog 配置会丢弃所有这种消息。你需要在 syslog 守护进程的配置文件中增加类似以下的内容，使其生效： local0.* /var/log/postgresql 在 Windows 上，当你使用 log_destination 的 eventlog 选项时，你应该在操作系统中注册一个事件源及其库，这样 Windows 事件查看器能够清楚地显示事件日志消息。详见第 18.12 节。","description_zh_html":"\u003cp\u003e\n\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 支持多种记录服务器消息的方法，包括\n         \u003cspan class=\"systemitem\"\u003estderr\u003c/span\u003e，\u003cspan class=\"systemitem\"\u003ecsvlog\u003c/span\u003e，\u003cspan class=\"systemitem\"\u003ejsonlog\u003c/span\u003e 和\n         \u003cspan class=\"systemitem\"\u003esyslog\u003c/span\u003e。在 Windows 上，\u003cspan class=\"systemitem\"\u003eeventlog\u003c/span\u003e 也受支持。将此参数设置为以逗号分隔的所需日志目的地列表。默认情况下仅记录到\n         \u003cspan class=\"systemitem\"\u003estderr\u003c/span\u003e。此参数只能在 \u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e\n         文件或服务器命令行中设置。\n       \u003c/p\u003e\u003cp\u003e\n        如果 \u003cspan class=\"systemitem\"\u003ecsvlog\u003c/span\u003e 被包括在 \u003ccode class=\"varname\"\u003elog_destination\u003c/code\u003e 中，日志项会以\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e逗号分隔值\u003c/span\u003e”\u003c/span\u003e（\u003cacronym class=\"acronym\"\u003eCSV\u003c/acronym\u003e）格式被输出，这样可以很方便地把日志载入到程序中。详见\u003ca class=\"xref\" href=\"/zh/docs/18/runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-CSVLOG\" title=\"19.8.4. 使用 CSV 格式的日志输出\"\u003e第 19.8.4 节\u003c/a\u003e。要产生 CSV 格式的日志输出，必须启用 \u003ca class=\"xref\" href=\"/zh/docs/18/runtime-config-logging.html#GUC-LOGGING-COLLECTOR\"\u003elogging_collector\u003c/a\u003e。\n       \u003c/p\u003e\u003cp\u003e\n        如果 \u003cspan class=\"systemitem\"\u003ejsonlog\u003c/span\u003e 包含在 \u003ccode class=\"varname\"\u003elog_destination\u003c/code\u003e 中，日志条目将以 \u003cacronym class=\"acronym\"\u003eJSON\u003c/acronym\u003e 格式输出，这对将日志加载到程序中很方便。有关详细信息，请参见\u003ca class=\"xref\" href=\"/zh/docs/18/runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-JSONLOG\" title=\"19.8.5. 使用JSON格式的日志输出\"\u003e第 19.8.5 节\u003c/a\u003e。必须启用 \u003ca class=\"xref\" href=\"/zh/docs/18/runtime-config-logging.html#GUC-LOGGING-COLLECTOR\"\u003elogging_collector\u003c/a\u003e 才能生成 JSON 格式的日志输出。\n       \u003c/p\u003e\u003cp\u003e\n        当包含 \u003cspan class=\"systemitem\"\u003estderr\u003c/span\u003e、\u003cspan class=\"systemitem\"\u003ecsvlog\u003c/span\u003e 或 \u003cspan class=\"systemitem\"\u003ejsonlog\u003c/span\u003e 时，文件 \u003ccode class=\"filename\"\u003ecurrent_logfiles\u003c/code\u003e 会被创建，记录日志收集器当前使用的日志文件位置和相关的日志目的地。这提供了一种方便的方式来查找实例当前使用的日志。以下是该文件内容的示例：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\nstderr log/postgresql.log\ncsvlog log/postgresql.csv\njsonlog log/postgresql.json\n\u003c/pre\u003e\u003cp\u003e\n\n        当由于轮换而创建新的日志文件时，以及重新加载 \u003ccode class=\"varname\"\u003elog_destination\u003c/code\u003e 时，\u003ccode class=\"filename\"\u003ecurrent_logfiles\u003c/code\u003e 会被重新创建。当 \u003ccode class=\"varname\"\u003elog_destination\u003c/code\u003e 中不包含 \u003cspan class=\"systemitem\"\u003estderr\u003c/span\u003e、\u003cspan class=\"systemitem\"\u003ecsvlog\u003c/span\u003e 或 \u003cspan class=\"systemitem\"\u003ejsonlog\u003c/span\u003e，或者日志收集器被禁用时，它会被移除。\n       \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003e注意\u003c/h3\u003e\u003cp\u003e\n         在大多数 Unix 系统上，你将需要修改系统的 \u003cspan class=\"application\"\u003esyslog\u003c/span\u003e 守护进程的配置来使用 \u003ccode class=\"varname\"\u003elog_destination\u003c/code\u003e 的 \u003cspan class=\"systemitem\"\u003esyslog\u003c/span\u003e 选项。\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 可以在 \u003cspan class=\"application\"\u003esyslog\u003c/span\u003e 设施 \u003ccode class=\"literal\"\u003eLOCAL0\u003c/code\u003e 到 \u003ccode class=\"literal\"\u003eLOCAL7\u003c/code\u003e 中记录（见 \u003ca class=\"xref\" href=\"/zh/docs/18/runtime-config-logging.html#GUC-SYSLOG-FACILITY\"\u003esyslog_facility\u003c/a\u003e），但是大部分平台上的默认 \u003cspan class=\"application\"\u003esyslog\u003c/span\u003e 配置会丢弃所有这种消息。你需要在 \u003cspan class=\"application\"\u003esyslog\u003c/span\u003e 守护进程的配置文件中增加类似以下的内容，使其生效：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\nlocal0.*    /var/log/postgresql\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n         在 Windows 上，当你使用 \u003ccode class=\"varname\"\u003elog_destination\u003c/code\u003e 的 \u003ccode class=\"literal\"\u003eeventlog\u003c/code\u003e 选项时，你应该在操作系统中注册一个事件源及其库，这样 Windows 事件查看器能够清楚地显示事件日志消息。详见\u003ca class=\"xref\" href=\"/zh/docs/18/event-log-registration.html\" title=\"18.12. 在Windows上注册事件日志\"\u003e第 18.12 节\u003c/a\u003e。\n        \u003c/p\u003e\u003c/div\u003e","doc":{"anchor":"GUC-LOG-DESTINATION","file":"runtime-config-logging.html","lang":"en","sha256":"278d913b9c0f735c5cd7b35fd7205826bbd9c449805370d2dbe54105c0ed1d88","slug":"18"},"doc_html":"\u003cp\u003e\n\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e supports several methods\n         for logging server messages, including\n         \u003cspan class=\"systemitem\"\u003estderr\u003c/span\u003e, \u003cspan class=\"systemitem\"\u003ecsvlog\u003c/span\u003e,\n         \u003cspan class=\"systemitem\"\u003ejsonlog\u003c/span\u003e, and\n         \u003cspan class=\"systemitem\"\u003esyslog\u003c/span\u003e. On Windows,\n         \u003cspan class=\"systemitem\"\u003eeventlog\u003c/span\u003e is also supported. Set this\n         parameter to a list of desired log destinations separated by\n         commas. The default is to log to \u003cspan class=\"systemitem\"\u003estderr\u003c/span\u003e\n         only.\n         This parameter can only be set in the \u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e\n         file or on the server command line.\n       \u003c/p\u003e\u003cp\u003e\n        If \u003cspan class=\"systemitem\"\u003ecsvlog\u003c/span\u003e is included in \u003ccode class=\"varname\"\u003elog_destination\u003c/code\u003e,\n        log entries are output in \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003ecomma-separated\n        value\u003c/span\u003e”\u003c/span\u003e (\u003cacronym class=\"acronym\"\u003eCSV\u003c/acronym\u003e) format, which is convenient for\n        loading logs into programs.\n        See \u003ca class=\"xref\" href=\"/docs/18/runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-CSVLOG\" title=\"19.8.4. Using CSV-Format Log Output\"\u003eSection 19.8.4\u003c/a\u003e for details.\n        \u003ca class=\"xref\" href=\"/docs/18/runtime-config-logging.html#GUC-LOGGING-COLLECTOR\"\u003elogging_collector\u003c/a\u003e must be enabled to generate\n        CSV-format log output.\n       \u003c/p\u003e\u003cp\u003e\n        If \u003cspan class=\"systemitem\"\u003ejsonlog\u003c/span\u003e is included in\n        \u003ccode class=\"varname\"\u003elog_destination\u003c/code\u003e, log entries are output in\n        \u003cacronym class=\"acronym\"\u003eJSON\u003c/acronym\u003e format, which is convenient for loading logs\n        into programs.\n        See \u003ca class=\"xref\" href=\"/docs/18/runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-JSONLOG\" title=\"19.8.5. Using JSON-Format Log Output\"\u003eSection 19.8.5\u003c/a\u003e for details.\n        \u003ca class=\"xref\" href=\"/docs/18/runtime-config-logging.html#GUC-LOGGING-COLLECTOR\"\u003elogging_collector\u003c/a\u003e must be enabled to generate\n        JSON-format log output.\n       \u003c/p\u003e\u003cp\u003e\n        When either \u003cspan class=\"systemitem\"\u003estderr\u003c/span\u003e,\n        \u003cspan class=\"systemitem\"\u003ecsvlog\u003c/span\u003e or \u003cspan class=\"systemitem\"\u003ejsonlog\u003c/span\u003e are\n        included, the file \u003ccode class=\"filename\"\u003ecurrent_logfiles\u003c/code\u003e is created to\n        record the location of the log file(s) currently in use by the logging\n        collector and the associated logging destination. This provides a\n        convenient way to find the logs currently in use by the instance. Here\n        is an example of this file's content:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\nstderr log/postgresql.log\ncsvlog log/postgresql.csv\njsonlog log/postgresql.json\n\u003c/pre\u003e\u003cp\u003e\n\u003ccode class=\"filename\"\u003ecurrent_logfiles\u003c/code\u003e is recreated when a new log file\n        is created as an effect of rotation, and\n        when \u003ccode class=\"varname\"\u003elog_destination\u003c/code\u003e is reloaded.  It is removed when\n        none of \u003cspan class=\"systemitem\"\u003estderr\u003c/span\u003e,\n        \u003cspan class=\"systemitem\"\u003ecsvlog\u003c/span\u003e or \u003cspan class=\"systemitem\"\u003ejsonlog\u003c/span\u003e are\n        included in \u003ccode class=\"varname\"\u003elog_destination\u003c/code\u003e, and when the logging\n        collector is disabled.\n       \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n         On most Unix systems, you will need to alter the configuration of\n         your system's \u003cspan class=\"application\"\u003esyslog\u003c/span\u003e daemon in order\n         to make use of the \u003cspan class=\"systemitem\"\u003esyslog\u003c/span\u003e option for\n         \u003ccode class=\"varname\"\u003elog_destination\u003c/code\u003e.  \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e\n         can log to \u003cspan class=\"application\"\u003esyslog\u003c/span\u003e facilities\n         \u003ccode class=\"literal\"\u003eLOCAL0\u003c/code\u003e through \u003ccode class=\"literal\"\u003eLOCAL7\u003c/code\u003e (see \u003ca class=\"xref\" href=\"/docs/18/runtime-config-logging.html#GUC-SYSLOG-FACILITY\"\u003esyslog_facility\u003c/a\u003e), but the default\n         \u003cspan class=\"application\"\u003esyslog\u003c/span\u003e configuration on most platforms\n         will discard all such messages.  You will need to add something like:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\nlocal0.*    /var/log/postgresql\n\u003c/pre\u003e\u003cp\u003e\n         to the  \u003cspan class=\"application\"\u003esyslog\u003c/span\u003e daemon's configuration file\n         to make it work.\n        \u003c/p\u003e\u003cp\u003e\n         On Windows, when you use the \u003ccode class=\"literal\"\u003eeventlog\u003c/code\u003e\n         option for \u003ccode class=\"varname\"\u003elog_destination\u003c/code\u003e, you should\n         register an event source and its library with the operating\n         system so that the Windows Event Viewer can display event\n         log messages cleanly.\n         See \u003ca class=\"xref\" href=\"/docs/18/event-log-registration.html\" title=\"18.12. Registering Event Log on Windows\"\u003eSection 18.12\u003c/a\u003e for details.\n        \u003c/p\u003e\u003c/div\u003e","doc_same_as":"","documentation_revision":{"inputs":[{"file":"runtime-config-logging.html","kind":"same-version-reviewed-manual","locale":"en","sha256":"278d913b9c0f735c5cd7b35fd7205826bbd9c449805370d2dbe54105c0ed1d88","version":"18.7"},{"file":"runtime-config-logging.html","kind":"same-version-reviewed-manual","locale":"zh-Hans","sha256":"68c010254e1859ec0b76f06a563babd51a6c38997f1242e35e4c6b649724b1cb","version":"18.7"}],"release":"18.7","runtime_remeasured":false,"source_revision":"pgdoc:b9f0e7232f60f380d642ac9b99226606c254b552"},"documented":true,"enumvals":null,"extra_desc":"Valid values are combinations of \"stderr\", \"syslog\", \"csvlog\", \"jsonlog\", and \"eventlog\", depending on the platform.","lang":"en","max_val":null,"metadata_version":"18","min_val":null,"name":"log_destination","short_desc":"Sets the destination for server log output.","source":"pg-settings-source-snapshot","translation_provenance":{"inputs":[{"kind":"current-pgdoc-translation","path":"/Users/vonng/pgsty/pgdoc/zh/18/html/runtime-config-logging.html","sha256":"a322f5293f10e348b5fc5dca98fdb6af52462723a215b8701c3b9d933e2933b4"}],"kind":"same-version-pgdoc","locale":"zh-Hans","source_revision":"b1b500221dbe5437cfca004d6b04d3f6e422765d","version":"18"},"unit":null,"vartype":"string","zh_from":"same-version-manual"},"ManualEvidence":{"doc":{"anchor":"GUC-LOG-DESTINATION","file":"runtime-config-logging.html","lang":"en","sha256":"278d913b9c0f735c5cd7b35fd7205826bbd9c449805370d2dbe54105c0ed1d88","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"log_destination","SourceDatabase":"center","Version":"18","Locale":"en","Title":"log_destination","Summary":"PostgreSQL supports several methods for logging server messages, including stderr, csvlog, jsonlog, and syslog. On Windows, eventlog is also supported. Set this parameter to a list of desired log destinations separated by commas. The default is to log to stderr only. This parameter can only be set in the postgresql.conf file or on the server command line. If csvlog is included in log_destination, log entries are output in “comma-separated value” (CSV) format, which is convenient for loading logs into programs. See Section 19.8.4 for details. logging_collector must be enabled to generate CSV-format log output. If jsonlog is included in log_destination, log entries are output in JSON format, which is convenient for loading logs into programs. See Section 19.8.5 for details. logging_collector must be enabled to generate JSON-format log output. When either stderr, csvlog or jsonlog are included, the file current_logfiles is created to record the location of the log file(s) currently in use by the logging collector and the associated logging destination. This provides a convenient way to find the logs currently in use by the instance. Here is an example of this file's content: stderr log/postgresql.log csvlog log/postgresql.csv jsonlog log/postgresql.json current_logfiles is recreated when a new log file is created as an effect of rotation, and when log_destination is reloaded. It is removed when none of stderr, csvlog or jsonlog are included in log_destination, and when the logging collector is disabled. Note On most Unix systems, you will need to alter the configuration of your system's syslog daemon in order to make use of the syslog option for log_destination. PostgreSQL can log to syslog facilities LOCAL0 through LOCAL7 (see syslog_facility), but the default syslog configuration on most platforms will discard all such messages. You will need to add something like: local0.* /var/log/postgresql to the syslog daemon's configuration file to make it work. On Windows, when you use the eventlog option for log_destination, you should register an event source and its library with the operating system so that the Windows Event Viewer can display event log messages cleanly. See Section 18.12 for details.","BodyHTML":"\u003cp\u003e\n\u003cspan\u003ePostgreSQL\u003c/span\u003e supports several methods\n         for logging server messages, including\n         \u003cspan\u003estderr\u003c/span\u003e, \u003cspan\u003ecsvlog\u003c/span\u003e,\n         \u003cspan\u003ejsonlog\u003c/span\u003e, and\n         \u003cspan\u003esyslog\u003c/span\u003e. On Windows,\n         \u003cspan\u003eeventlog\u003c/span\u003e is also supported. Set this\n         parameter to a list of desired log destinations separated by\n         commas. The default is to log to \u003cspan\u003estderr\u003c/span\u003e\n         only.\n         This parameter can only be set in the \u003ccode\u003epostgresql.conf\u003c/code\u003e\n         file or on the server command line.\n       \u003c/p\u003e\u003cp\u003e\n        If \u003cspan\u003ecsvlog\u003c/span\u003e is included in \u003ccode\u003elog_destination\u003c/code\u003e,\n        log entries are output in \u003cspan\u003e“\u003cspan\u003ecomma-separated\n        value\u003c/span\u003e”\u003c/span\u003e (\u003cacronym\u003eCSV\u003c/acronym\u003e) format, which is convenient for\n        loading logs into programs.\n        See \u003ca href=\"/docs/18/runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-CSVLOG\" rel=\"nofollow\"\u003eSection 19.8.4\u003c/a\u003e for details.\n        \u003ca href=\"/docs/18/runtime-config-logging.html#GUC-LOGGING-COLLECTOR\" rel=\"nofollow\"\u003elogging_collector\u003c/a\u003e must be enabled to generate\n        CSV-format log output.\n       \u003c/p\u003e\u003cp\u003e\n        If \u003cspan\u003ejsonlog\u003c/span\u003e is included in\n        \u003ccode\u003elog_destination\u003c/code\u003e, log entries are output in\n        \u003cacronym\u003eJSON\u003c/acronym\u003e format, which is convenient for loading logs\n        into programs.\n        See \u003ca href=\"/docs/18/runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-JSONLOG\" rel=\"nofollow\"\u003eSection 19.8.5\u003c/a\u003e for details.\n        \u003ca href=\"/docs/18/runtime-config-logging.html#GUC-LOGGING-COLLECTOR\" rel=\"nofollow\"\u003elogging_collector\u003c/a\u003e must be enabled to generate\n        JSON-format log output.\n       \u003c/p\u003e\u003cp\u003e\n        When either \u003cspan\u003estderr\u003c/span\u003e,\n        \u003cspan\u003ecsvlog\u003c/span\u003e or \u003cspan\u003ejsonlog\u003c/span\u003e are\n        included, the file \u003ccode\u003ecurrent_logfiles\u003c/code\u003e is created to\n        record the location of the log file(s) currently in use by the logging\n        collector and the associated logging destination. This provides a\n        convenient way to find the logs currently in use by the instance. Here\n        is an example of this file\u0026#39;s content:\n\u003c/p\u003e\u003cpre\u003e\nstderr log/postgresql.log\ncsvlog log/postgresql.csv\njsonlog log/postgresql.json\n\u003c/pre\u003e\u003cp\u003e\n\u003ccode\u003ecurrent_logfiles\u003c/code\u003e is recreated when a new log file\n        is created as an effect of rotation, and\n        when \u003ccode\u003elog_destination\u003c/code\u003e is reloaded.  It is removed when\n        none of \u003cspan\u003estderr\u003c/span\u003e,\n        \u003cspan\u003ecsvlog\u003c/span\u003e or \u003cspan\u003ejsonlog\u003c/span\u003e are\n        included in \u003ccode\u003elog_destination\u003c/code\u003e, and when the logging\n        collector is disabled.\n       \u003c/p\u003e\u003cdiv\u003e\u003ch3\u003eNote\u003c/h3\u003e\u003cp\u003e\n         On most Unix systems, you will need to alter the configuration of\n         your system\u0026#39;s \u003cspan\u003esyslog\u003c/span\u003e daemon in order\n         to make use of the \u003cspan\u003esyslog\u003c/span\u003e option for\n         \u003ccode\u003elog_destination\u003c/code\u003e.  \u003cspan\u003ePostgreSQL\u003c/span\u003e\n         can log to \u003cspan\u003esyslog\u003c/span\u003e facilities\n         \u003ccode\u003eLOCAL0\u003c/code\u003e through \u003ccode\u003eLOCAL7\u003c/code\u003e (see \u003ca href=\"/docs/18/runtime-config-logging.html#GUC-SYSLOG-FACILITY\" rel=\"nofollow\"\u003esyslog_facility\u003c/a\u003e), but the default\n         \u003cspan\u003esyslog\u003c/span\u003e configuration on most platforms\n         will discard all such messages.  You will need to add something like:\n\u003c/p\u003e\u003cpre\u003e\nlocal0.*    /var/log/postgresql\n\u003c/pre\u003e\u003cp\u003e\n         to the  \u003cspan\u003esyslog\u003c/span\u003e daemon\u0026#39;s configuration file\n         to make it work.\n        \u003c/p\u003e\u003cp\u003e\n         On Windows, when you use the \u003ccode\u003eeventlog\u003c/code\u003e\n         option for \u003ccode\u003elog_destination\u003c/code\u003e, you should\n         register an event source and its library with the operating\n         system so that the Windows Event Viewer can display event\n         log messages cleanly.\n         See \u003ca href=\"/docs/18/event-log-registration.html\" rel=\"nofollow\"\u003eSection 18.12\u003c/a\u003e for details.\n        \u003c/p\u003e\u003c/div\u003e","SourceRevision":"wiki-repair-20261023:7e76ee9d164ebe1de91d59012f4bb4f911d1e2636a7ba4e4f8577178cd8bd20f","ContentHash":"d08fbcc12c881cf907af0cc2c72f5b2a2c1e3ee18565a5a3c6c07e63b51dfc8d","Payload":{"description":"PostgreSQL supports several methods for logging server messages, including stderr, csvlog, jsonlog, and syslog. On Windows, eventlog is also supported. Set this parameter to a list of desired log destinations separated by commas. The default is to log to stderr only. This parameter can only be set in the postgresql.conf file or on the server command line. If csvlog is included in log_destination, log entries are output in “comma-separated value” (CSV) format, which is convenient for loading logs into programs. See Section 19.8.4 for details. logging_collector must be enabled to generate CSV-format log output. If jsonlog is included in log_destination, log entries are output in JSON format, which is convenient for loading logs into programs. See Section 19.8.5 for details. logging_collector must be enabled to generate JSON-format log output. When either stderr, csvlog or jsonlog are included, the file current_logfiles is created to record the location of the log file(s) currently in use by the logging collector and the associated logging destination. This provides a convenient way to find the logs currently in use by the instance. Here is an example of this file's content: stderr log/postgresql.log csvlog log/postgresql.csv jsonlog log/postgresql.json current_logfiles is recreated when a new log file is created as an effect of rotation, and when log_destination is reloaded. It is removed when none of stderr, csvlog or jsonlog are included in log_destination, and when the logging collector is disabled. Note On most Unix systems, you will need to alter the configuration of your system's syslog daemon in order to make use of the syslog option for log_destination. PostgreSQL can log to syslog facilities LOCAL0 through LOCAL7 (see syslog_facility), but the default syslog configuration on most platforms will discard all such messages. You will need to add something like: local0.* /var/log/postgresql to the syslog daemon's configuration file to make it work. On Windows, when you use the eventlog option for log_destination, you should register an event source and its library with the operating system so that the Windows Event Viewer can display event log messages cleanly. See Section 18.12 for details."}},"RequestedLocale":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
