{"Entry":{"collection":"guc","key":"logging_collector","name":"logging_collector","aliases":[],"metadata":{"baseline":false,"boot_human":"Not specified","boot_val":null,"category":"Reporting and Logging / Where to Log","category_zh":"","changed_in":["13"],"changes":[{"documentation_changed":false,"fields":{},"from":"8.2","status":"added","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.6","status":"changed","to":"10"},{"documentation_changed":false,"fields":{"short_desc":{"from":"Start a subprocess to capture stderr output and/or csvlogs into log files.","to":"Start a subprocess to capture stderr, csvlog and/or jsonlog into log files."}},"from":"12","status":"changed","to":"13"},{"documentation_changed":true,"fields":{},"from":"18","status":"changed","to":"19"}],"content_hash":"e76b84ded18bcf6cd3ce6a1c94efbbe5b745c287f887eaa5f4ba9ce46c599a96","context":"","default_changed_in":[],"default_history":[{"from":"9.0","to":"19","value":"off"}],"derived_content_hash":"6308015f78a2b6f62050848059142186ca363e865cc1d03e2a43f2fe7d681993","documentation_refresh":{"batch":"20261113","original_source_rev":"wiki-repair-20261023:3986e50ff41ab53841f9252a9aa40b8ed46ce34909852823bc8554a8db9a40b6","versions":{"14":"14.25","15":"15.20","16":"16.16","17":"17.12","18":"18.7","19":"19rc2"}},"editorial":{"advice":{"olap":"Analytical workloads can emit large bursts at query completion; size collector and destination I/O for that burst and verify database processes do not stall behind collector backpressure.","oltp":"Enable logging_collector when csvlog/jsonlog or collector-managed stderr files are required, then load-test pipe throughput, rotation, disk-full behavior, shipping, and restart. It is a POSTMASTER setting and needs a controlled restart.","small":"Use one required format and bounded retention. A small node still needs disk alerts because the collector is designed not to lose messages and can propagate backpressure when its destination is slow or full."},"mechanism":["logging_collector starts a subprocess to capture stderr, csvlog and/or jsonlog into log files. The collector drains server stderr through a pipe and writes configured file formats; it is designed not to lose messages, so extreme backpressure can block emitters.","logging_collector is a POSTMASTER-context setting: PostgreSQL reads it during server startup, and a configuration reload or session SET cannot activate a new 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":["Expecting a reload or SET to activate logging_collector, although it requires a controlled server restart.","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.","Enabling file-oriented destinations without the collector, or starting the collector without a disk and retention plan."],"references":[{"title":"PostgreSQL 19 Beta 4: logging_collector","url":"https://www.postgresql.org/docs/19/runtime-config-logging.html#GUC-LOGGING-COLLECTOR"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["log_destination","log_directory","log_filename","log_rotation_age","log_rotation_size"],"summary":"logging_collector is the PostgreSQL setting that controls whether PostgreSQL starts a subprocess to capture stderr, csvlog and/or jsonlog into log files."},"enumvals":[],"first_version":"8.3","group":"Reporting and Logging","group_slug":"logging","imported_at":"2026-09-30T00:40:57.459455+08:00","intro_commit":{},"key":"logging_collector","last_version":"20","max_val":"","min_val":"","name":"logging_collector","position":257,"present_in":["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:bd68f36178d8f1d5eb80dff8875c12b72e409377f28d8391fc1f411ba034a322","receipt_sha256":"4a44268d4e09ae2aec95782d18635c1da9fd5b5f5f9a642d543ea505905fa185","repair":"wiki-repair-20261023"},"short_desc":"This parameter enables the logging collector, which is a background process that captures log messages sent to stderr and redirects them into log files.","short_desc_zh":"","source_rev":"wiki-repair-20261023:3986e50ff41ab53841f9252a9aa40b8ed46ce34909852823bc8554a8db9a40b6","unit":"","vartype":"bool"}},"Definition":{"Collection":"guc","Key":"logging_collector","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"logging_collector","SourceRevision":"wiki-repair-20261023:3986e50ff41ab53841f9252a9aa40b8ed46ce34909852823bc8554a8db9a40b6","Facts":{"boot_val":"off","category":"Reporting and Logging / Where to Log","context":"postmaster","description":"This parameter enables the logging collector, which is a background process that captures log messages sent to stderr and redirects them into log files. This approach is often more useful than logging to syslog, since some types of messages might not appear in syslog output. (One common example is dynamic-linker failure messages; another is error messages produced by scripts such as archive_command.) This parameter can only be set at server start. Note It is possible to log to stderr without using the logging collector; the log messages will just go to wherever the server's stderr is directed. However, that method is only suitable for low log volumes, since it provides no convenient way to rotate log files. Also, on some platforms not using the logging collector can result in lost or garbled log output, because multiple processes writing concurrently to the same log file can overwrite each other's output. Note The logging collector is designed to avoid dropping messages. This means that in case of extremely high load, server processes could be blocked while trying to send additional log messages when the collector has fallen behind. In contrast, syslog prefers to drop messages if it cannot write them, which means it may fail to log some messages in such cases but it will not block the rest of the system. The logging collector does not guarantee that log messages have reached durable storage. It can still lose messages due to a system crash, power loss, or an error while writing the log file.","description_zh":"这个参数启用日志收集器，它是一个捕捉被发送到 stderr 的日志消息的后台进程，并且它会将这些消息重定向到日志文件中。这种方法比记录到 syslog 通常更有用，因为某些类型的消息可能不会在 syslog 输出中出现（一个常见的示例是动态链接器错误消息；另一个示例是由 archive_command 等脚本产生的错误消息）。这个参数只能在服务器启动时设置。 注意 也可以不使用日志收集器而把日志记录到 stderr，日志消息将只会去到服务器的 stderr 被定向到的位置。不过，那种方法只适合于低日志量，因为它没有提供便捷的方法来轮转日志文件。还有，在某些平台上，不使用日志收集器可能会导致日志输出丢失或混杂，因为多个进程并发写入同一个日志文件时会覆盖彼此的输出。 注意 日志收集器旨在避免丢弃消息。这意味着在极高的负载下，如果服务器进程试图在收集器已经落后时发送更多的日志消息，那么它可能会被阻塞。相反，syslog 倾向于在无法写入消息时丢掉消息，这意味着在这样的情况下它可能会无法记录某些消息，但是它不会阻塞系统的其他部分。 日志收集器不保证日志消息已到达持久化存储。系统崩溃、断电或写入日志文件时出错，仍可能导致消息丢失。","description_zh_html":"\u003cp\u003e\n         这个参数启用\u003cem class=\"firstterm\"\u003e日志收集器\u003c/em\u003e，它是一个捕捉被发送到 \u003cspan class=\"systemitem\"\u003estderr\u003c/span\u003e 的日志消息的后台进程，并且它会将这些消息重定向到日志文件中。这种方法比记录到 \u003cspan class=\"application\"\u003esyslog\u003c/span\u003e 通常更有用，因为某些类型的消息可能不会在 \u003cspan class=\"application\"\u003esyslog\u003c/span\u003e 输出中出现（一个常见的示例是动态链接器错误消息；另一个示例是由 \u003ccode class=\"varname\"\u003earchive_command\u003c/code\u003e 等脚本产生的错误消息）。这个参数只能在服务器启动时设置。\n       \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003e注意\u003c/h3\u003e\u003cp\u003e\n         也可以不使用日志收集器而把日志记录到 \u003cspan class=\"systemitem\"\u003estderr\u003c/span\u003e，日志消息将只会去到服务器的 \u003cspan class=\"systemitem\"\u003estderr\u003c/span\u003e 被定向到的位置。不过，那种方法只适合于低日志量，因为它没有提供便捷的方法来轮转日志文件。还有，在某些平台上，不使用日志收集器可能会导致日志输出丢失或混杂，因为多个进程并发写入同一个日志文件时会覆盖彼此的输出。\n        \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003e注意\u003c/h3\u003e\u003cp\u003e\n          日志收集器旨在避免丢弃消息。这意味着在极高的负载下，如果服务器进程试图在收集器已经落后时发送更多的日志消息，那么它可能会被阻塞。相反，\u003cspan class=\"application\"\u003esyslog\u003c/span\u003e 倾向于在无法写入消息时丢掉消息，这意味着在这样的情况下它可能会无法记录某些消息，但是它不会阻塞系统的其他部分。\n        \u003c/p\u003e\u003cp\u003e\n         日志收集器不保证日志消息已到达持久化存储。系统崩溃、断电或写入日志文件时出错，仍可能导致消息丢失。\n        \u003c/p\u003e\u003c/div\u003e","doc":{"anchor":"GUC-LOGGING-COLLECTOR","file":"runtime-config-logging.html","lang":"en","sha256":"278d913b9c0f735c5cd7b35fd7205826bbd9c449805370d2dbe54105c0ed1d88","slug":"18"},"doc_html":"\u003cp\u003e\n         This parameter enables the \u003cem class=\"firstterm\"\u003elogging collector\u003c/em\u003e, which\n         is a background process that captures log messages\n         sent to \u003cspan class=\"systemitem\"\u003estderr\u003c/span\u003e and redirects them into log files.\n         This approach is often more useful than\n         logging to \u003cspan class=\"application\"\u003esyslog\u003c/span\u003e, since some types of messages\n         might not appear in \u003cspan class=\"application\"\u003esyslog\u003c/span\u003e output.  (One common\n         example is dynamic-linker failure messages; another is error messages\n         produced by scripts such as \u003ccode class=\"varname\"\u003earchive_command\u003c/code\u003e.)\n         This parameter can only be set at server start.\n       \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n         It is possible to log to \u003cspan class=\"systemitem\"\u003estderr\u003c/span\u003e without using the\n         logging collector; the log messages will just go to wherever the\n         server's \u003cspan class=\"systemitem\"\u003estderr\u003c/span\u003e is directed.  However, that method is\n         only suitable for low log volumes, since it provides no convenient\n         way to rotate log files.  Also, on some platforms not using the\n         logging collector can result in lost or garbled log output, because\n         multiple processes writing concurrently to the same log file can\n         overwrite each other's output.\n        \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n          The logging collector is designed to avoid dropping messages.  This means\n          that in case of extremely high load, server processes could be\n          blocked while trying to send additional log messages when the\n          collector has fallen behind.  In contrast, \u003cspan class=\"application\"\u003esyslog\u003c/span\u003e\n          prefers to drop messages if it cannot write them, which means it\n          may fail to log some messages in such cases but it will not block\n          the rest of the system.\n        \u003c/p\u003e\u003cp\u003e\n         The logging collector does not guarantee that log messages have\n         reached durable storage.  It can still lose messages due to a system\n         crash, power loss, or an error while writing the log file.\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":null,"lang":"en","max_val":null,"metadata_version":"18","min_val":null,"name":"logging_collector","short_desc":"Start a subprocess to capture stderr, csvlog and/or jsonlog into log files.","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":"bool","zh_from":"same-version-manual"},"ManualEvidence":{"doc":{"anchor":"GUC-LOGGING-COLLECTOR","file":"runtime-config-logging.html","lang":"en","sha256":"278d913b9c0f735c5cd7b35fd7205826bbd9c449805370d2dbe54105c0ed1d88","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"logging_collector","SourceDatabase":"center","Version":"18","Locale":"en","Title":"logging_collector","Summary":"This parameter enables the logging collector, which is a background process that captures log messages sent to stderr and redirects them into log files. This approach is often more useful than logging to syslog, since some types of messages might not appear in syslog output. (One common example is dynamic-linker failure messages; another is error messages produced by scripts such as archive_command.) This parameter can only be set at server start. Note It is possible to log to stderr without using the logging collector; the log messages will just go to wherever the server's stderr is directed. However, that method is only suitable for low log volumes, since it provides no convenient way to rotate log files. Also, on some platforms not using the logging collector can result in lost or garbled log output, because multiple processes writing concurrently to the same log file can overwrite each other's output. Note The logging collector is designed to avoid dropping messages. This means that in case of extremely high load, server processes could be blocked while trying to send additional log messages when the collector has fallen behind. In contrast, syslog prefers to drop messages if it cannot write them, which means it may fail to log some messages in such cases but it will not block the rest of the system. The logging collector does not guarantee that log messages have reached durable storage. It can still lose messages due to a system crash, power loss, or an error while writing the log file.","BodyHTML":"\u003cp\u003e\n         This parameter enables the \u003cem\u003elogging collector\u003c/em\u003e, which\n         is a background process that captures log messages\n         sent to \u003cspan\u003estderr\u003c/span\u003e and redirects them into log files.\n         This approach is often more useful than\n         logging to \u003cspan\u003esyslog\u003c/span\u003e, since some types of messages\n         might not appear in \u003cspan\u003esyslog\u003c/span\u003e output.  (One common\n         example is dynamic-linker failure messages; another is error messages\n         produced by scripts such as \u003ccode\u003earchive_command\u003c/code\u003e.)\n         This parameter can only be set at server start.\n       \u003c/p\u003e\u003cdiv\u003e\u003ch3\u003eNote\u003c/h3\u003e\u003cp\u003e\n         It is possible to log to \u003cspan\u003estderr\u003c/span\u003e without using the\n         logging collector; the log messages will just go to wherever the\n         server\u0026#39;s \u003cspan\u003estderr\u003c/span\u003e is directed.  However, that method is\n         only suitable for low log volumes, since it provides no convenient\n         way to rotate log files.  Also, on some platforms not using the\n         logging collector can result in lost or garbled log output, because\n         multiple processes writing concurrently to the same log file can\n         overwrite each other\u0026#39;s output.\n        \u003c/p\u003e\u003c/div\u003e\u003cdiv\u003e\u003ch3\u003eNote\u003c/h3\u003e\u003cp\u003e\n          The logging collector is designed to avoid dropping messages.  This means\n          that in case of extremely high load, server processes could be\n          blocked while trying to send additional log messages when the\n          collector has fallen behind.  In contrast, \u003cspan\u003esyslog\u003c/span\u003e\n          prefers to drop messages if it cannot write them, which means it\n          may fail to log some messages in such cases but it will not block\n          the rest of the system.\n        \u003c/p\u003e\u003cp\u003e\n         The logging collector does not guarantee that log messages have\n         reached durable storage.  It can still lose messages due to a system\n         crash, power loss, or an error while writing the log file.\n        \u003c/p\u003e\u003c/div\u003e","SourceRevision":"wiki-repair-20261023:3986e50ff41ab53841f9252a9aa40b8ed46ce34909852823bc8554a8db9a40b6","ContentHash":"78e838c708859bbd886c39f1bff4b183f8de5ac667f955d10fbd5c92954590b4","Payload":{"description":"This parameter enables the logging collector, which is a background process that captures log messages sent to stderr and redirects them into log files. This approach is often more useful than logging to syslog, since some types of messages might not appear in syslog output. (One common example is dynamic-linker failure messages; another is error messages produced by scripts such as archive_command.) This parameter can only be set at server start. Note It is possible to log to stderr without using the logging collector; the log messages will just go to wherever the server's stderr is directed. However, that method is only suitable for low log volumes, since it provides no convenient way to rotate log files. Also, on some platforms not using the logging collector can result in lost or garbled log output, because multiple processes writing concurrently to the same log file can overwrite each other's output. Note The logging collector is designed to avoid dropping messages. This means that in case of extremely high load, server processes could be blocked while trying to send additional log messages when the collector has fallen behind. In contrast, syslog prefers to drop messages if it cannot write them, which means it may fail to log some messages in such cases but it will not block the rest of the system. The logging collector does not guarantee that log messages have reached durable storage. It can still lose messages due to a system crash, power loss, or an error while writing the log file."}},"RequestedLocale":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","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}
