]> begriffs open source - ai-pg/blob - full-docs/html/runtime-config-logging.html
Include latest toc output
[ai-pg] / full-docs / html / runtime-config-logging.html
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>19.8. Error Reporting and Logging</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="runtime-config-query.html" title="19.7. Query Planning" /><link rel="next" href="runtime-config-statistics.html" title="19.9. Run-time Statistics" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">19.8. Error Reporting and Logging</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="runtime-config-query.html" title="19.7. Query Planning">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="runtime-config.html" title="Chapter 19. Server Configuration">Up</a></td><th width="60%" align="center">Chapter 19. Server Configuration</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="runtime-config-statistics.html" title="19.9. Run-time Statistics">Next</a></td></tr></table><hr /></div><div class="sect1" id="RUNTIME-CONFIG-LOGGING"><div class="titlepage"><div><div><h2 class="title" style="clear: both">19.8. Error Reporting and Logging <a href="#RUNTIME-CONFIG-LOGGING" class="id_link">#</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="sect2"><a href="runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-WHERE">19.8.1. Where to Log</a></span></dt><dt><span class="sect2"><a href="runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-WHEN">19.8.2. When to Log</a></span></dt><dt><span class="sect2"><a href="runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-WHAT">19.8.3. What to Log</a></span></dt><dt><span class="sect2"><a href="runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-CSVLOG">19.8.4. Using CSV-Format Log Output</a></span></dt><dt><span class="sect2"><a href="runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-JSONLOG">19.8.5. Using JSON-Format Log Output</a></span></dt><dt><span class="sect2"><a href="runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-PROC-TITLE">19.8.6. Process Title</a></span></dt></dl></div><a id="id-1.6.6.11.2" class="indexterm"></a><div class="sect2" id="RUNTIME-CONFIG-LOGGING-WHERE"><div class="titlepage"><div><div><h3 class="title">19.8.1. Where to Log <a href="#RUNTIME-CONFIG-LOGGING-WHERE" class="id_link">#</a></h3></div></div></div><a id="id-1.6.6.11.3.2" class="indexterm"></a><a id="id-1.6.6.11.3.3" class="indexterm"></a><div class="variablelist"><dl class="variablelist"><dt id="GUC-LOG-DESTINATION"><span class="term"><code class="varname">log_destination</code> (<code class="type">string</code>)
3       <a id="id-1.6.6.11.3.4.1.1.3" class="indexterm"></a>
4       </span> <a href="#GUC-LOG-DESTINATION" class="id_link">#</a></dt><dd><p>
5         <span class="productname">PostgreSQL</span> supports several methods
6          for logging server messages, including
7          <span class="systemitem">stderr</span>, <span class="systemitem">csvlog</span>,
8          <span class="systemitem">jsonlog</span>, and
9          <span class="systemitem">syslog</span>. On Windows,
10          <span class="systemitem">eventlog</span> is also supported. Set this
11          parameter to a list of desired log destinations separated by
12          commas. The default is to log to <span class="systemitem">stderr</span>
13          only.
14          This parameter can only be set in the <code class="filename">postgresql.conf</code>
15          file or on the server command line.
16        </p><p>
17         If <span class="systemitem">csvlog</span> is included in <code class="varname">log_destination</code>,
18         log entries are output in <span class="quote">“<span class="quote">comma-separated
19         value</span>”</span> (<acronym class="acronym">CSV</acronym>) format, which is convenient for
20         loading logs into programs.
21         See <a class="xref" href="runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-CSVLOG" title="19.8.4. Using CSV-Format Log Output">Section 19.8.4</a> for details.
22         <a class="xref" href="runtime-config-logging.html#GUC-LOGGING-COLLECTOR">logging_collector</a> must be enabled to generate
23         CSV-format log output.
24        </p><p>
25         If <span class="systemitem">jsonlog</span> is included in
26         <code class="varname">log_destination</code>, log entries are output in
27         <acronym class="acronym">JSON</acronym> format, which is convenient for loading logs
28         into programs.
29         See <a class="xref" href="runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-JSONLOG" title="19.8.5. Using JSON-Format Log Output">Section 19.8.5</a> for details.
30         <a class="xref" href="runtime-config-logging.html#GUC-LOGGING-COLLECTOR">logging_collector</a> must be enabled to generate
31         JSON-format log output.
32        </p><p>
33         When either <span class="systemitem">stderr</span>,
34         <span class="systemitem">csvlog</span> or <span class="systemitem">jsonlog</span> are
35         included, the file <code class="filename">current_logfiles</code> is created to
36         record the location of the log file(s) currently in use by the logging
37         collector and the associated logging destination. This provides a
38         convenient way to find the logs currently in use by the instance. Here
39         is an example of this file's content:
40 </p><pre class="programlisting">
41 stderr log/postgresql.log
42 csvlog log/postgresql.csv
43 jsonlog log/postgresql.json
44 </pre><p>
45
46         <code class="filename">current_logfiles</code> is recreated when a new log file
47         is created as an effect of rotation, and
48         when <code class="varname">log_destination</code> is reloaded.  It is removed when
49         none of <span class="systemitem">stderr</span>,
50         <span class="systemitem">csvlog</span> or <span class="systemitem">jsonlog</span> are
51         included in <code class="varname">log_destination</code>, and when the logging
52         collector is disabled.
53        </p><div class="note"><h3 class="title">Note</h3><p>
54          On most Unix systems, you will need to alter the configuration of
55          your system's <span class="application">syslog</span> daemon in order
56          to make use of the <span class="systemitem">syslog</span> option for
57          <code class="varname">log_destination</code>.  <span class="productname">PostgreSQL</span>
58          can log to <span class="application">syslog</span> facilities
59          <code class="literal">LOCAL0</code> through <code class="literal">LOCAL7</code> (see <a class="xref" href="runtime-config-logging.html#GUC-SYSLOG-FACILITY">syslog_facility</a>), but the default
60          <span class="application">syslog</span> configuration on most platforms
61          will discard all such messages.  You will need to add something like:
62 </p><pre class="programlisting">
63 local0.*    /var/log/postgresql
64 </pre><p>
65          to the  <span class="application">syslog</span> daemon's configuration file
66          to make it work.
67         </p><p>
68          On Windows, when you use the <code class="literal">eventlog</code>
69          option for <code class="varname">log_destination</code>, you should
70          register an event source and its library with the operating
71          system so that the Windows Event Viewer can display event
72          log messages cleanly.
73          See <a class="xref" href="event-log-registration.html" title="18.12. Registering Event Log on Windows">Section 18.12</a> for details.
74         </p></div></dd><dt id="GUC-LOGGING-COLLECTOR"><span class="term"><code class="varname">logging_collector</code> (<code class="type">boolean</code>)
75       <a id="id-1.6.6.11.3.4.2.1.3" class="indexterm"></a>
76       </span> <a href="#GUC-LOGGING-COLLECTOR" class="id_link">#</a></dt><dd><p>
77          This parameter enables the <em class="firstterm">logging collector</em>, which
78          is a background process that captures log messages
79          sent to <span class="systemitem">stderr</span> and redirects them into log files.
80          This approach is often more useful than
81          logging to <span class="application">syslog</span>, since some types of messages
82          might not appear in <span class="application">syslog</span> output.  (One common
83          example is dynamic-linker failure messages; another is error messages
84          produced by scripts such as <code class="varname">archive_command</code>.)
85          This parameter can only be set at server start.
86        </p><div class="note"><h3 class="title">Note</h3><p>
87          It is possible to log to <span class="systemitem">stderr</span> without using the
88          logging collector; the log messages will just go to wherever the
89          server's <span class="systemitem">stderr</span> is directed.  However, that method is
90          only suitable for low log volumes, since it provides no convenient
91          way to rotate log files.  Also, on some platforms not using the
92          logging collector can result in lost or garbled log output, because
93          multiple processes writing concurrently to the same log file can
94          overwrite each other's output.
95         </p></div><div class="note"><h3 class="title">Note</h3><p>
96           The logging collector is designed to never lose messages.  This means
97           that in case of extremely high load, server processes could be
98           blocked while trying to send additional log messages when the
99           collector has fallen behind.  In contrast, <span class="application">syslog</span>
100           prefers to drop messages if it cannot write them, which means it
101           may fail to log some messages in such cases but it will not block
102           the rest of the system.
103         </p></div></dd><dt id="GUC-LOG-DIRECTORY"><span class="term"><code class="varname">log_directory</code> (<code class="type">string</code>)
104       <a id="id-1.6.6.11.3.4.3.1.3" class="indexterm"></a>
105       </span> <a href="#GUC-LOG-DIRECTORY" class="id_link">#</a></dt><dd><p>
106         When <code class="varname">logging_collector</code> is enabled,
107         this parameter determines the directory in which log files will be created.
108         It can be specified as an absolute path, or relative to the
109         cluster data directory.
110         This parameter can only be set in the <code class="filename">postgresql.conf</code>
111         file or on the server command line.
112         The default is <code class="literal">log</code>.
113        </p></dd><dt id="GUC-LOG-FILENAME"><span class="term"><code class="varname">log_filename</code> (<code class="type">string</code>)
114       <a id="id-1.6.6.11.3.4.4.1.3" class="indexterm"></a>
115       </span> <a href="#GUC-LOG-FILENAME" class="id_link">#</a></dt><dd><p>
116         When <code class="varname">logging_collector</code> is enabled,
117         this parameter sets the file names of the created log files.  The value
118         is treated as a <code class="function">strftime</code> pattern,
119         so <code class="literal">%</code>-escapes can be used to specify time-varying
120         file names.  (Note that if there are
121         any time-zone-dependent <code class="literal">%</code>-escapes, the computation
122         is done in the zone specified
123         by <a class="xref" href="runtime-config-logging.html#GUC-LOG-TIMEZONE">log_timezone</a>.)
124         The supported <code class="literal">%</code>-escapes are similar to those
125         listed in the Open Group's <a class="ulink" href="https://pubs.opengroup.org/onlinepubs/009695399/functions/strftime.html" target="_top">strftime
126         </a> specification.
127         Note that the system's <code class="function">strftime</code> is not used
128         directly, so platform-specific (nonstandard) extensions do not work.
129         The default is <code class="literal">postgresql-%Y-%m-%d_%H%M%S.log</code>.
130        </p><p>
131         If you specify a file name without escapes, you should plan to
132         use a log rotation utility to avoid eventually filling the
133         entire disk.  In releases prior to 8.4, if
134         no <code class="literal">%</code> escapes were
135         present, <span class="productname">PostgreSQL</span> would append
136         the epoch of the new log file's creation time, but this is no
137         longer the case.
138        </p><p>
139         If CSV-format output is enabled in <code class="varname">log_destination</code>,
140         <code class="literal">.csv</code> will be appended to the timestamped
141         log file name to create the file name for CSV-format output.
142         (If <code class="varname">log_filename</code> ends in <code class="literal">.log</code>, the suffix is
143         replaced instead.)
144        </p><p>
145         If JSON-format output is enabled in <code class="varname">log_destination</code>,
146         <code class="literal">.json</code> will be appended to the timestamped
147         log file name to create the file name for JSON-format output.
148         (If <code class="varname">log_filename</code> ends in <code class="literal">.log</code>, the suffix is
149         replaced instead.)
150        </p><p>
151         This parameter can only be set in the <code class="filename">postgresql.conf</code>
152         file or on the server command line.
153        </p></dd><dt id="GUC-LOG-FILE-MODE"><span class="term"><code class="varname">log_file_mode</code> (<code class="type">integer</code>)
154       <a id="id-1.6.6.11.3.4.5.1.3" class="indexterm"></a>
155       </span> <a href="#GUC-LOG-FILE-MODE" class="id_link">#</a></dt><dd><p>
156         On Unix systems this parameter sets the permissions for log files
157         when <code class="varname">logging_collector</code> is enabled. (On Microsoft
158         Windows this parameter is ignored.)
159         The parameter value is expected to be a numeric mode
160         specified in the format accepted by the
161         <code class="function">chmod</code> and <code class="function">umask</code>
162         system calls.  (To use the customary octal format the number
163         must start with a <code class="literal">0</code> (zero).)
164        </p><p>
165         The default permissions are <code class="literal">0600</code>, meaning only the
166         server owner can read or write the log files.  The other commonly
167         useful setting is <code class="literal">0640</code>, allowing members of the owner's
168         group to read the files.  Note however that to make use of such a
169         setting, you'll need to alter <a class="xref" href="runtime-config-logging.html#GUC-LOG-DIRECTORY">log_directory</a> to
170         store the files somewhere outside the cluster data directory.  In
171         any case, it's unwise to make the log files world-readable, since
172         they might contain sensitive data.
173        </p><p>
174         This parameter can only be set in the <code class="filename">postgresql.conf</code>
175         file or on the server command line.
176        </p></dd><dt id="GUC-LOG-ROTATION-AGE"><span class="term"><code class="varname">log_rotation_age</code> (<code class="type">integer</code>)
177       <a id="id-1.6.6.11.3.4.6.1.3" class="indexterm"></a>
178       </span> <a href="#GUC-LOG-ROTATION-AGE" class="id_link">#</a></dt><dd><p>
179         When <code class="varname">logging_collector</code> is enabled,
180         this parameter determines the maximum amount of time to use an
181         individual log file, after which a new log file will be created.
182         If this value is specified without units, it is taken as minutes.
183         The default is 24 hours.
184         Set to zero to disable time-based creation of new log files.
185         This parameter can only be set in the <code class="filename">postgresql.conf</code>
186         file or on the server command line.
187        </p></dd><dt id="GUC-LOG-ROTATION-SIZE"><span class="term"><code class="varname">log_rotation_size</code> (<code class="type">integer</code>)
188       <a id="id-1.6.6.11.3.4.7.1.3" class="indexterm"></a>
189       </span> <a href="#GUC-LOG-ROTATION-SIZE" class="id_link">#</a></dt><dd><p>
190         When <code class="varname">logging_collector</code> is enabled,
191         this parameter determines the maximum size of an individual log file.
192         After this amount of data has been emitted into a log file,
193         a new log file will be created.
194         If this value is specified without units, it is taken as kilobytes.
195         The default is 10 megabytes.
196         Set to zero to disable size-based creation of new log files.
197         This parameter can only be set in the <code class="filename">postgresql.conf</code>
198         file or on the server command line.
199        </p></dd><dt id="GUC-LOG-TRUNCATE-ON-ROTATION"><span class="term"><code class="varname">log_truncate_on_rotation</code> (<code class="type">boolean</code>)
200       <a id="id-1.6.6.11.3.4.8.1.3" class="indexterm"></a>
201       </span> <a href="#GUC-LOG-TRUNCATE-ON-ROTATION" class="id_link">#</a></dt><dd><p>
202         When <code class="varname">logging_collector</code> is enabled,
203         this parameter will cause <span class="productname">PostgreSQL</span> to truncate (overwrite),
204         rather than append to, any existing log file of the same name.
205         However, truncation will occur only when a new file is being opened
206         due to time-based rotation, not during server startup or size-based
207         rotation.  When off, pre-existing files will be appended to in
208         all cases.  For example, using this setting in combination with
209         a <code class="varname">log_filename</code> like <code class="literal">postgresql-%H.log</code>
210         would result in generating twenty-four hourly log files and then
211         cyclically overwriting them.
212         This parameter can only be set in the <code class="filename">postgresql.conf</code>
213         file or on the server command line.
214        </p><p>
215         Example:  To keep 7 days of logs, one log file per day named
216         <code class="literal">server_log.Mon</code>, <code class="literal">server_log.Tue</code>,
217         etc., and automatically overwrite last week's log with this week's log,
218         set <code class="varname">log_filename</code> to <code class="literal">server_log.%a</code>,
219         <code class="varname">log_truncate_on_rotation</code> to <code class="literal">on</code>, and
220         <code class="varname">log_rotation_age</code> to <code class="literal">1440</code>.
221        </p><p>
222         Example: To keep 24 hours of logs, one log file per hour, but
223         also rotate sooner if the log file size exceeds 1GB, set
224         <code class="varname">log_filename</code> to <code class="literal">server_log.%H%M</code>,
225         <code class="varname">log_truncate_on_rotation</code> to <code class="literal">on</code>,
226         <code class="varname">log_rotation_age</code> to <code class="literal">60</code>, and
227         <code class="varname">log_rotation_size</code> to <code class="literal">1000000</code>.
228         Including <code class="literal">%M</code> in <code class="varname">log_filename</code> allows
229         any size-driven rotations that might occur to select a file name
230         different from the hour's initial file name.
231        </p></dd><dt id="GUC-SYSLOG-FACILITY"><span class="term"><code class="varname">syslog_facility</code> (<code class="type">enum</code>)
232       <a id="id-1.6.6.11.3.4.9.1.3" class="indexterm"></a>
233       </span> <a href="#GUC-SYSLOG-FACILITY" class="id_link">#</a></dt><dd><p>
234         When logging to <span class="application">syslog</span> is enabled, this parameter
235         determines the <span class="application">syslog</span>
236         <span class="quote">“<span class="quote">facility</span>”</span> to be used.  You can choose
237         from <code class="literal">LOCAL0</code>, <code class="literal">LOCAL1</code>,
238         <code class="literal">LOCAL2</code>, <code class="literal">LOCAL3</code>, <code class="literal">LOCAL4</code>,
239         <code class="literal">LOCAL5</code>, <code class="literal">LOCAL6</code>, <code class="literal">LOCAL7</code>;
240         the default is <code class="literal">LOCAL0</code>. See also the
241         documentation of your system's
242         <span class="application">syslog</span> daemon.
243         This parameter can only be set in the <code class="filename">postgresql.conf</code>
244         file or on the server command line.
245        </p></dd><dt id="GUC-SYSLOG-IDENT"><span class="term"><code class="varname">syslog_ident</code> (<code class="type">string</code>)
246       <a id="id-1.6.6.11.3.4.10.1.3" class="indexterm"></a>
247       </span> <a href="#GUC-SYSLOG-IDENT" class="id_link">#</a></dt><dd><p>
248          When logging to <span class="application">syslog</span> is enabled, this parameter
249          determines the program name used to identify
250          <span class="productname">PostgreSQL</span> messages in
251          <span class="application">syslog</span> logs. The default is
252          <code class="literal">postgres</code>.
253          This parameter can only be set in the <code class="filename">postgresql.conf</code>
254          file or on the server command line.
255         </p></dd><dt id="GUC-SYSLOG-SEQUENCE-NUMBERS"><span class="term"><code class="varname">syslog_sequence_numbers</code> (<code class="type">boolean</code>)
256         <a id="id-1.6.6.11.3.4.11.1.3" class="indexterm"></a>
257        </span> <a href="#GUC-SYSLOG-SEQUENCE-NUMBERS" class="id_link">#</a></dt><dd><p>
258          When logging to <span class="application">syslog</span> and this is on (the
259          default), then each message will be prefixed by an increasing
260          sequence number (such as <code class="literal">[2]</code>).  This circumvents
261          the <span class="quote">“<span class="quote">--- last message repeated N times ---</span>”</span> suppression
262          that many syslog implementations perform by default.  In more modern
263          syslog implementations, repeated message suppression can be configured
264          (for example, <code class="literal">$RepeatedMsgReduction</code>
265          in <span class="productname">rsyslog</span>), so this might not be
266          necessary.  Also, you could turn this off if you actually want to
267          suppress repeated messages.
268         </p><p>
269          This parameter can only be set in the <code class="filename">postgresql.conf</code>
270          file or on the server command line.
271         </p></dd><dt id="GUC-SYSLOG-SPLIT-MESSAGES"><span class="term"><code class="varname">syslog_split_messages</code> (<code class="type">boolean</code>)
272       <a id="id-1.6.6.11.3.4.12.1.3" class="indexterm"></a>
273       </span> <a href="#GUC-SYSLOG-SPLIT-MESSAGES" class="id_link">#</a></dt><dd><p>
274         When logging to <span class="application">syslog</span> is enabled, this parameter
275         determines how messages are delivered to syslog.  When on (the
276         default), messages are split by lines, and long lines are split so
277         that they will fit into 1024 bytes, which is a typical size limit for
278         traditional syslog implementations.  When off, PostgreSQL server log
279         messages are delivered to the syslog service as is, and it is up to
280         the syslog service to cope with the potentially bulky messages.
281        </p><p>
282         If syslog is ultimately logging to a text file, then the effect will
283         be the same either way, and it is best to leave the setting on, since
284         most syslog implementations either cannot handle large messages or
285         would need to be specially configured to handle them.  But if syslog
286         is ultimately writing into some other medium, it might be necessary or
287         more useful to keep messages logically together.
288        </p><p>
289         This parameter can only be set in the <code class="filename">postgresql.conf</code>
290         file or on the server command line.
291        </p></dd><dt id="GUC-EVENT-SOURCE"><span class="term"><code class="varname">event_source</code> (<code class="type">string</code>)
292       <a id="id-1.6.6.11.3.4.13.1.3" class="indexterm"></a>
293       </span> <a href="#GUC-EVENT-SOURCE" class="id_link">#</a></dt><dd><p>
294         When logging to <span class="application">event log</span> is enabled, this parameter
295         determines the program name used to identify
296         <span class="productname">PostgreSQL</span> messages in
297         the log. The default is <code class="literal">PostgreSQL</code>.
298         This parameter can only be set in the <code class="filename">postgresql.conf</code>
299         file or on the server command line.
300        </p></dd></dl></div></div><div class="sect2" id="RUNTIME-CONFIG-LOGGING-WHEN"><div class="titlepage"><div><div><h3 class="title">19.8.2. When to Log <a href="#RUNTIME-CONFIG-LOGGING-WHEN" class="id_link">#</a></h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt id="GUC-LOG-MIN-MESSAGES"><span class="term"><code class="varname">log_min_messages</code> (<code class="type">enum</code>)
301       <a id="id-1.6.6.11.4.2.1.1.3" class="indexterm"></a>
302       </span> <a href="#GUC-LOG-MIN-MESSAGES" class="id_link">#</a></dt><dd><p>
303         Controls which <a class="link" href="runtime-config-logging.html#RUNTIME-CONFIG-SEVERITY-LEVELS" title="Table 19.2. Message Severity Levels">message
304         levels</a> are written to the server log.
305         Valid values are <code class="literal">DEBUG5</code>, <code class="literal">DEBUG4</code>,
306         <code class="literal">DEBUG3</code>, <code class="literal">DEBUG2</code>, <code class="literal">DEBUG1</code>,
307         <code class="literal">INFO</code>, <code class="literal">NOTICE</code>, <code class="literal">WARNING</code>,
308         <code class="literal">ERROR</code>, <code class="literal">LOG</code>, <code class="literal">FATAL</code>, and
309         <code class="literal">PANIC</code>.  Each level includes all the levels that
310         follow it.  The later the level, the fewer messages are sent
311         to the log.  The default is <code class="literal">WARNING</code>.  Note that
312         <code class="literal">LOG</code> has a different rank here than in
313         <a class="xref" href="runtime-config-client.html#GUC-CLIENT-MIN-MESSAGES">client_min_messages</a>.
314         Only superusers and users with the appropriate <code class="literal">SET</code>
315         privilege can change this setting.
316        </p></dd><dt id="GUC-LOG-MIN-ERROR-STATEMENT"><span class="term"><code class="varname">log_min_error_statement</code> (<code class="type">enum</code>)
317       <a id="id-1.6.6.11.4.2.2.1.3" class="indexterm"></a>
318       </span> <a href="#GUC-LOG-MIN-ERROR-STATEMENT" class="id_link">#</a></dt><dd><p>
319         Controls which SQL statements that cause an error
320         condition are recorded in the server log.  The current
321         SQL statement is included in the log entry for any message of
322         the specified
323         <a class="link" href="runtime-config-logging.html#RUNTIME-CONFIG-SEVERITY-LEVELS" title="Table 19.2. Message Severity Levels">severity</a>
324         or higher.
325         Valid values are <code class="literal">DEBUG5</code>,
326         <code class="literal">DEBUG4</code>, <code class="literal">DEBUG3</code>,
327         <code class="literal">DEBUG2</code>, <code class="literal">DEBUG1</code>,
328         <code class="literal">INFO</code>, <code class="literal">NOTICE</code>,
329         <code class="literal">WARNING</code>, <code class="literal">ERROR</code>,
330         <code class="literal">LOG</code>,
331         <code class="literal">FATAL</code>, and <code class="literal">PANIC</code>.
332         The default is <code class="literal">ERROR</code>, which means statements
333         causing errors, log messages, fatal errors, or panics will be logged.
334         To effectively turn off logging of failing statements,
335         set this parameter to <code class="literal">PANIC</code>.
336         Only superusers and users with the appropriate <code class="literal">SET</code>
337         privilege can change this setting.
338        </p></dd><dt id="GUC-LOG-MIN-DURATION-STATEMENT"><span class="term"><code class="varname">log_min_duration_statement</code> (<code class="type">integer</code>)
339       <a id="id-1.6.6.11.4.2.3.1.3" class="indexterm"></a>
340       </span> <a href="#GUC-LOG-MIN-DURATION-STATEMENT" class="id_link">#</a></dt><dd><p>
341          Causes the duration of each completed statement to be logged
342          if the statement ran for at least the specified amount of time.
343          For example, if you set it to <code class="literal">250ms</code>
344          then all SQL statements that run 250ms or longer will be
345          logged.  Enabling this parameter can be helpful in tracking down
346          unoptimized queries in your applications.
347          If this value is specified without units, it is taken as milliseconds.
348          Setting this to zero prints all statement durations.
349          <code class="literal">-1</code> (the default) disables logging statement
350          durations.
351          Only superusers and users with the appropriate <code class="literal">SET</code>
352          privilege can change this setting.
353         </p><p>
354          This overrides <a class="xref" href="runtime-config-logging.html#GUC-LOG-MIN-DURATION-SAMPLE">log_min_duration_sample</a>,
355          meaning that queries with duration exceeding this setting are not
356          subject to sampling and are always logged.
357         </p><p>
358          For clients using extended query protocol, durations of the Parse,
359          Bind, and Execute steps are logged independently.
360         </p><div class="note"><h3 class="title">Note</h3><p>
361          When using this option together with
362          <a class="xref" href="runtime-config-logging.html#GUC-LOG-STATEMENT">log_statement</a>,
363          the text of statements that are logged because of
364          <code class="varname">log_statement</code> will not be repeated in the
365          duration log message.
366          If you are not using <span class="application">syslog</span>, it is recommended
367          that you log the PID or session ID using
368          <a class="xref" href="runtime-config-logging.html#GUC-LOG-LINE-PREFIX">log_line_prefix</a>
369          so that you can link the statement message to the later
370          duration message using the process ID or session ID.
371         </p></div></dd><dt id="GUC-LOG-MIN-DURATION-SAMPLE"><span class="term"><code class="varname">log_min_duration_sample</code> (<code class="type">integer</code>)
372       <a id="id-1.6.6.11.4.2.4.1.3" class="indexterm"></a>
373       </span> <a href="#GUC-LOG-MIN-DURATION-SAMPLE" class="id_link">#</a></dt><dd><p>
374          Allows sampling the duration of completed statements that ran for
375          at least the specified amount of time.  This produces the same
376          kind of log entries as
377          <a class="xref" href="runtime-config-logging.html#GUC-LOG-MIN-DURATION-STATEMENT">log_min_duration_statement</a>, but only for a
378          subset of the executed statements, with sample rate controlled by
379          <a class="xref" href="runtime-config-logging.html#GUC-LOG-STATEMENT-SAMPLE-RATE">log_statement_sample_rate</a>.
380          For example, if you set it to <code class="literal">100ms</code> then all
381          SQL statements that run 100ms or longer will be considered for
382          sampling.  Enabling this parameter can be helpful when the
383          traffic is too high to log all queries.
384          If this value is specified without units, it is taken as milliseconds.
385          Setting this to zero samples all statement durations.
386          <code class="literal">-1</code> (the default) disables sampling statement
387          durations.
388          Only superusers and users with the appropriate <code class="literal">SET</code>
389          privilege can change this setting.
390         </p><p>
391          This setting has lower priority
392          than <code class="varname">log_min_duration_statement</code>, meaning that
393          statements with durations
394          exceeding <code class="varname">log_min_duration_statement</code> are not
395          subject to sampling and are always logged.
396         </p><p>
397          Other notes for <code class="varname">log_min_duration_statement</code>
398          apply also to this setting.
399         </p></dd><dt id="GUC-LOG-STATEMENT-SAMPLE-RATE"><span class="term"><code class="varname">log_statement_sample_rate</code> (<code class="type">floating point</code>)
400       <a id="id-1.6.6.11.4.2.5.1.3" class="indexterm"></a>
401       </span> <a href="#GUC-LOG-STATEMENT-SAMPLE-RATE" class="id_link">#</a></dt><dd><p>
402          Determines the fraction of statements with duration exceeding
403          <a class="xref" href="runtime-config-logging.html#GUC-LOG-MIN-DURATION-SAMPLE">log_min_duration_sample</a> that will be logged.
404          Sampling is stochastic, for example <code class="literal">0.5</code> means
405          there is statistically one chance in two that any given statement
406          will be logged.
407          The default is <code class="literal">1.0</code>, meaning to log all sampled
408          statements.
409          Setting this to zero disables sampled statement-duration logging,
410          the same as setting
411          <code class="varname">log_min_duration_sample</code> to
412          <code class="literal">-1</code>.
413          Only superusers and users with the appropriate <code class="literal">SET</code>
414          privilege can change this setting.
415         </p></dd><dt id="GUC-LOG-TRANSACTION-SAMPLE-RATE"><span class="term"><code class="varname">log_transaction_sample_rate</code> (<code class="type">floating point</code>)
416       <a id="id-1.6.6.11.4.2.6.1.3" class="indexterm"></a>
417       </span> <a href="#GUC-LOG-TRANSACTION-SAMPLE-RATE" class="id_link">#</a></dt><dd><p>
418          Sets the fraction of transactions whose statements are all logged,
419          in addition to statements logged for other reasons.  It applies to
420          each new transaction regardless of its statements' durations.
421          Sampling is stochastic, for example <code class="literal">0.1</code> means
422          there is statistically one chance in ten that any given transaction
423          will be logged.
424          <code class="varname">log_transaction_sample_rate</code> can be helpful to
425          construct a sample of transactions.
426          The default is <code class="literal">0</code>, meaning not to log
427          statements from any additional transactions.  Setting this
428          to <code class="literal">1</code> logs all statements of all transactions.
429          Only superusers and users with the appropriate <code class="literal">SET</code>
430          privilege can change this setting.
431         </p><div class="note"><h3 class="title">Note</h3><p>
432          Like all statement-logging options, this option can add significant
433          overhead.
434         </p></div></dd><dt id="GUC-LOG-STARTUP-PROGRESS-INTERVAL"><span class="term"><code class="varname">log_startup_progress_interval</code> (<code class="type">integer</code>)
435       <a id="id-1.6.6.11.4.2.7.1.3" class="indexterm"></a>
436       </span> <a href="#GUC-LOG-STARTUP-PROGRESS-INTERVAL" class="id_link">#</a></dt><dd><p>
437          Sets the amount of time after which the startup process will log
438          a message about a long-running operation that is still in progress,
439          as well as the interval between further progress messages for that
440          operation. The default is 10 seconds. A setting of <code class="literal">0</code>
441          disables the feature.  If this value is specified without units,
442          it is taken as milliseconds.  This setting is applied separately to
443          each operation.
444          This parameter can only be set in the <code class="filename">postgresql.conf</code>
445          file or on the server command line.
446         </p><p>
447          For example, if syncing the data directory takes 25 seconds and
448          thereafter resetting unlogged relations takes 8 seconds, and if this
449          setting has the default value of 10 seconds, then a messages will be
450          logged for syncing the data directory after it has been in progress
451          for 10 seconds and again after it has been in progress for 20 seconds,
452          but nothing will be logged for resetting unlogged relations.
453         </p></dd></dl></div><p>
454      <a class="xref" href="runtime-config-logging.html#RUNTIME-CONFIG-SEVERITY-LEVELS" title="Table 19.2. Message Severity Levels">Table 19.2</a> explains the message
455      severity levels used by <span class="productname">PostgreSQL</span>.  If logging output
456      is sent to <span class="systemitem">syslog</span> or Windows'
457      <span class="systemitem">eventlog</span>, the severity levels are translated
458      as shown in the table.
459     </p><div class="table" id="RUNTIME-CONFIG-SEVERITY-LEVELS"><p class="title"><strong>Table 19.2. Message Severity Levels</strong></p><div class="table-contents"><table class="table" summary="Message Severity Levels" border="1"><colgroup><col class="col1" /><col class="col2" /><col class="col3" /><col class="col4" /></colgroup><thead><tr><th>Severity</th><th>Usage</th><th><span class="systemitem">syslog</span></th><th><span class="systemitem">eventlog</span></th></tr></thead><tbody><tr><td><code class="literal">DEBUG1 .. DEBUG5</code></td><td>Provides successively-more-detailed information for use by
460          developers.</td><td><code class="literal">DEBUG</code></td><td><code class="literal">INFORMATION</code></td></tr><tr><td><code class="literal">INFO</code></td><td>Provides information implicitly requested by the user,
461          e.g., output from <code class="command">VACUUM VERBOSE</code>.</td><td><code class="literal">INFO</code></td><td><code class="literal">INFORMATION</code></td></tr><tr><td><code class="literal">NOTICE</code></td><td>Provides information that might be helpful to users, e.g.,
462          notice of truncation of long identifiers.</td><td><code class="literal">NOTICE</code></td><td><code class="literal">INFORMATION</code></td></tr><tr><td><code class="literal">WARNING</code></td><td>Provides warnings of likely problems, e.g., <code class="command">COMMIT</code>
463          outside a transaction block.</td><td><code class="literal">NOTICE</code></td><td><code class="literal">WARNING</code></td></tr><tr><td><code class="literal">ERROR</code></td><td>Reports an error that caused the current command to
464          abort.</td><td><code class="literal">WARNING</code></td><td><code class="literal">ERROR</code></td></tr><tr><td><code class="literal">LOG</code></td><td>Reports information of interest to administrators, e.g.,
465          checkpoint activity.</td><td><code class="literal">INFO</code></td><td><code class="literal">INFORMATION</code></td></tr><tr><td><code class="literal">FATAL</code></td><td>Reports an error that caused the current session to
466          abort.</td><td><code class="literal">ERR</code></td><td><code class="literal">ERROR</code></td></tr><tr><td><code class="literal">PANIC</code></td><td>Reports an error that caused all database sessions to abort.</td><td><code class="literal">CRIT</code></td><td><code class="literal">ERROR</code></td></tr></tbody></table></div></div><br class="table-break" /></div><div class="sect2" id="RUNTIME-CONFIG-LOGGING-WHAT"><div class="titlepage"><div><div><h3 class="title">19.8.3. What to Log <a href="#RUNTIME-CONFIG-LOGGING-WHAT" class="id_link">#</a></h3></div></div></div><div class="note"><h3 class="title">Note</h3><p>
467        What you choose to log can have security implications;  see
468        <a class="xref" href="logfile-maintenance.html" title="24.3. Log File Maintenance">Section 24.3</a>.
469       </p></div><div class="variablelist"><dl class="variablelist"><dt id="GUC-APPLICATION-NAME"><span class="term"><code class="varname">application_name</code> (<code class="type">string</code>)
470       <a id="id-1.6.6.11.5.3.1.1.3" class="indexterm"></a>
471       </span> <a href="#GUC-APPLICATION-NAME" class="id_link">#</a></dt><dd><p>
472         The <code class="varname">application_name</code> can be any string of less than
473         <code class="symbol">NAMEDATALEN</code> characters (64 characters in a standard build).
474         It is typically set by an application upon connection to the server.
475         The name will be displayed in the <code class="structname">pg_stat_activity</code> view
476         and included in CSV log entries.  It can also be included in regular
477         log entries via the <a class="xref" href="runtime-config-logging.html#GUC-LOG-LINE-PREFIX">log_line_prefix</a> parameter.
478         Only printable ASCII characters may be used in the
479         <code class="varname">application_name</code> value.
480         Other characters are replaced with <a class="link" href="sql-syntax-lexical.html#SQL-SYNTAX-STRINGS-ESCAPE" title="4.1.2.2. String Constants with C-Style Escapes">C-style hexadecimal escapes</a>.
481        </p></dd><dt id="GUC-DEBUG-PRINT-PARSE"><span class="term"><code class="varname">debug_print_parse</code> (<code class="type">boolean</code>)
482       <a id="id-1.6.6.11.5.3.2.1.3" class="indexterm"></a>
483       <br /></span><span class="term"><code class="varname">debug_print_rewritten</code> (<code class="type">boolean</code>)
484       <a id="id-1.6.6.11.5.3.2.2.3" class="indexterm"></a>
485       <br /></span><span class="term"><code class="varname">debug_print_plan</code> (<code class="type">boolean</code>)
486       <a id="id-1.6.6.11.5.3.2.3.3" class="indexterm"></a>
487       </span> <a href="#GUC-DEBUG-PRINT-PARSE" class="id_link">#</a></dt><dd><p>
488         These parameters enable various debugging output to be emitted.
489         When set, they print the resulting parse tree, the query rewriter
490         output, or the execution plan for each executed query.
491         These messages are emitted at <code class="literal">LOG</code> message level, so by
492         default they will appear in the server log but will not be sent to the
493         client.  You can change that by adjusting
494         <a class="xref" href="runtime-config-client.html#GUC-CLIENT-MIN-MESSAGES">client_min_messages</a> and/or
495         <a class="xref" href="runtime-config-logging.html#GUC-LOG-MIN-MESSAGES">log_min_messages</a>.
496         These parameters are off by default.
497        </p></dd><dt id="GUC-DEBUG-PRETTY-PRINT"><span class="term"><code class="varname">debug_pretty_print</code> (<code class="type">boolean</code>)
498       <a id="id-1.6.6.11.5.3.3.1.3" class="indexterm"></a>
499       </span> <a href="#GUC-DEBUG-PRETTY-PRINT" class="id_link">#</a></dt><dd><p>
500         When set, <code class="varname">debug_pretty_print</code> indents the messages
501         produced by <code class="varname">debug_print_parse</code>,
502         <code class="varname">debug_print_rewritten</code>, or
503         <code class="varname">debug_print_plan</code>.  This results in more readable
504         but much longer output than the <span class="quote">“<span class="quote">compact</span>”</span> format used when
505         it is off.  It is on by default.
506        </p></dd><dt id="GUC-LOG-AUTOVACUUM-MIN-DURATION"><span class="term"><code class="varname">log_autovacuum_min_duration</code> (<code class="type">integer</code>)
507       <a id="id-1.6.6.11.5.3.4.1.3" class="indexterm"></a>
508       </span> <a href="#GUC-LOG-AUTOVACUUM-MIN-DURATION" class="id_link">#</a></dt><dd><p>
509         Causes each action executed by autovacuum to be logged if it ran for at
510         least the specified amount of time.  Setting this to zero logs
511         all autovacuum actions. <code class="literal">-1</code> disables logging autovacuum
512         actions. If this value is specified without units, it is taken as milliseconds.
513         For example, if you set this to
514         <code class="literal">250ms</code> then all automatic vacuums and analyzes that run
515         250ms or longer will be logged.  In addition, when this parameter is
516         set to any value other than <code class="literal">-1</code>, a message will be
517         logged if an autovacuum action is skipped due to a conflicting lock or a
518         concurrently dropped relation. The default is <code class="literal">10min</code>.
519         Enabling this parameter can be helpful in tracking autovacuum activity.
520         This parameter can only be set in the <code class="filename">postgresql.conf</code>
521         file or on the server command line; but the setting can be overridden for
522         individual tables by changing table storage parameters.
523        </p></dd><dt id="GUC-LOG-CHECKPOINTS"><span class="term"><code class="varname">log_checkpoints</code> (<code class="type">boolean</code>)
524       <a id="id-1.6.6.11.5.3.5.1.3" class="indexterm"></a>
525       </span> <a href="#GUC-LOG-CHECKPOINTS" class="id_link">#</a></dt><dd><p>
526         Causes checkpoints and restartpoints to be logged in the server log.
527         Some statistics are included in the log messages, including the number
528         of buffers written and the time spent writing them.
529         This parameter can only be set in the <code class="filename">postgresql.conf</code>
530         file or on the server command line. The default is on.
531        </p></dd><dt id="GUC-LOG-CONNECTIONS"><span class="term"><code class="varname">log_connections</code> (<code class="type">string</code>)
532       <a id="id-1.6.6.11.5.3.6.1.3" class="indexterm"></a>
533       </span> <a href="#GUC-LOG-CONNECTIONS" class="id_link">#</a></dt><dd><p>
534         Causes aspects of each connection to the server to be logged.
535         The default is the empty string, <code class="literal">''</code>, which
536         disables all connection logging. The following options may be
537         specified alone or in a comma-separated list:
538        </p><div class="table" id="LOG-CONNECTIONS-OPTIONS"><p class="title"><strong>Table 19.3. Log Connection Options</strong></p><div class="table-contents"><table class="table" summary="Log Connection Options" border="1"><colgroup><col class="col1" /><col class="col2" /></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code class="literal">receipt</code></td><td>Logs receipt of a connection.</td></tr><tr><td><code class="literal">authentication</code></td><td>
539             Logs the original identity used by an authentication method
540             to identify a user. In most cases, the identity string
541             matches the <span class="productname">PostgreSQL</span> username,
542             but some third-party authentication methods may alter the
543             original user identifier before the server stores it. Failed
544             authentication is always logged regardless of the value of
545             this setting.
546            </td></tr><tr><td><code class="literal">authorization</code></td><td>
547             Logs successful completion of authorization. At this point
548             the connection has been established but the backend is not
549             yet fully set up. The log message includes the authorized
550             username as well as the database name and application name,
551             if applicable.
552            </td></tr><tr><td><code class="literal">setup_durations</code></td><td>
553             Logs the time spent establishing the connection and setting up the
554             backend until the connection is ready to execute its first
555             query. The log message includes three durations:  the total
556             setup duration (starting from the postmaster accepting the
557             incoming connection and ending when the connection is ready
558             for query), the time it took to fork the new backend, and
559             the time it took to authenticate the user.
560            </td></tr><tr><td><code class="literal">all</code></td><td>
561             A convenience alias equivalent to specifying all options. If
562             <code class="literal">all</code> is specified in a list of other
563             options, all connection aspects will be logged.
564            </td></tr></tbody></table></div></div><br class="table-break" /><p>
565         Disconnection logging is separately controlled by <a class="xref" href="runtime-config-logging.html#GUC-LOG-DISCONNECTIONS">log_disconnections</a>.
566        </p><p>
567         For the purposes of backwards compatibility, <code class="literal">on</code>,
568         <code class="literal">off</code>, <code class="literal">true</code>,
569         <code class="literal">false</code>, <code class="literal">yes</code>,
570         <code class="literal">no</code>, <code class="literal">1</code>, and <code class="literal">0</code>
571         are still supported. The positive values are equivalent to specifying
572         the <code class="literal">receipt</code>, <code class="literal">authentication</code>, and
573         <code class="literal">authorization</code> options.
574        </p><p>
575         Only superusers and users with the appropriate <code class="literal">SET</code>
576         privilege can change this parameter at session start,
577         and it cannot be changed at all within a session.
578        </p><div class="note"><h3 class="title">Note</h3><p>
579          Some client programs, like <span class="application">psql</span>, attempt
580          to connect twice while determining if a password is required, so
581          duplicate <span class="quote">“<span class="quote">connection received</span>”</span> messages do not
582          necessarily indicate a problem.
583         </p></div></dd><dt id="GUC-LOG-DISCONNECTIONS"><span class="term"><code class="varname">log_disconnections</code> (<code class="type">boolean</code>)
584       <a id="id-1.6.6.11.5.3.7.1.3" class="indexterm"></a>
585       </span> <a href="#GUC-LOG-DISCONNECTIONS" class="id_link">#</a></dt><dd><p>
586         Causes session terminations to be logged.  The log output
587         provides information similar to <code class="varname">log_connections</code>,
588         plus the duration of the session.
589         Only superusers and users with the appropriate <code class="literal">SET</code>
590         privilege can change this parameter at session start,
591         and it cannot be changed at all within a session.
592         The default is <code class="literal">off</code>.
593        </p></dd><dt id="GUC-LOG-DURATION"><span class="term"><code class="varname">log_duration</code> (<code class="type">boolean</code>)
594       <a id="id-1.6.6.11.5.3.8.1.3" class="indexterm"></a>
595       </span> <a href="#GUC-LOG-DURATION" class="id_link">#</a></dt><dd><p>
596         Causes the duration of every completed statement to be logged.
597         The default is <code class="literal">off</code>.
598         Only superusers and users with the appropriate <code class="literal">SET</code>
599         privilege can change this setting.
600        </p><p>
601         For clients using extended query protocol, durations of the Parse,
602         Bind, and Execute steps are logged independently.
603        </p><div class="note"><h3 class="title">Note</h3><p>
604          The difference between enabling <code class="varname">log_duration</code> and setting
605          <a class="xref" href="runtime-config-logging.html#GUC-LOG-MIN-DURATION-STATEMENT">log_min_duration_statement</a> to zero is that
606          exceeding <code class="varname">log_min_duration_statement</code> forces the text of
607          the query to be logged, but this option doesn't.  Thus, if
608          <code class="varname">log_duration</code> is <code class="literal">on</code> and
609          <code class="varname">log_min_duration_statement</code> has a positive value, all
610          durations are logged but the query text is included only for
611          statements exceeding the threshold.  This behavior can be useful for
612          gathering statistics in high-load installations.
613         </p></div></dd><dt id="GUC-LOG-ERROR-VERBOSITY"><span class="term"><code class="varname">log_error_verbosity</code> (<code class="type">enum</code>)
614       <a id="id-1.6.6.11.5.3.9.1.3" class="indexterm"></a>
615       </span> <a href="#GUC-LOG-ERROR-VERBOSITY" class="id_link">#</a></dt><dd><p>
616         Controls the amount of detail written in the server log for each
617         message that is logged.  Valid values are <code class="literal">TERSE</code>,
618         <code class="literal">DEFAULT</code>, and <code class="literal">VERBOSE</code>, each adding more
619         fields to displayed messages.  <code class="literal">TERSE</code> excludes
620         the logging of <code class="literal">DETAIL</code>, <code class="literal">HINT</code>,
621         <code class="literal">QUERY</code>, and <code class="literal">CONTEXT</code> error information.
622         <code class="literal">VERBOSE</code> output includes the <code class="symbol">SQLSTATE</code> error
623         code (see also <a class="xref" href="errcodes-appendix.html" title="Appendix A. PostgreSQL Error Codes">Appendix A</a>) and the source code file name, function name,
624         and line number that generated the error.
625         Only superusers and users with the appropriate <code class="literal">SET</code>
626         privilege can change this setting.
627        </p></dd><dt id="GUC-LOG-HOSTNAME"><span class="term"><code class="varname">log_hostname</code> (<code class="type">boolean</code>)
628       <a id="id-1.6.6.11.5.3.10.1.3" class="indexterm"></a>
629       </span> <a href="#GUC-LOG-HOSTNAME" class="id_link">#</a></dt><dd><p>
630         By default, connection log messages only show the IP address of the
631         connecting host. Turning this parameter on causes logging of the
632         host name as well.  Note that depending on your host name resolution
633         setup this might impose a non-negligible performance penalty.
634         This parameter can only be set in the <code class="filename">postgresql.conf</code>
635         file or on the server command line.
636        </p></dd><dt id="GUC-LOG-LINE-PREFIX"><span class="term"><code class="varname">log_line_prefix</code> (<code class="type">string</code>)
637       <a id="id-1.6.6.11.5.3.11.1.3" class="indexterm"></a>
638       </span> <a href="#GUC-LOG-LINE-PREFIX" class="id_link">#</a></dt><dd><p>
639          This is a <code class="function">printf</code>-style string that is output at the
640          beginning of each log line.
641          <code class="literal">%</code> characters begin <span class="quote">“<span class="quote">escape sequences</span>”</span>
642          that are replaced with status information as outlined below.
643          Unrecognized escapes are ignored. Other
644          characters are copied straight to the log line. Some escapes are
645          only recognized by session processes, and will be treated as empty by
646          background processes such as the main server process. Status
647          information may be aligned either left or right by specifying a
648          numeric literal after the % and before the option. A negative
649          value will cause the status information to be padded on the
650          right with spaces to give it a minimum width, whereas a positive
651          value will pad on the left. Padding can be useful to aid human
652          readability in log files.
653        </p><p>
654          This parameter can only be set in the <code class="filename">postgresql.conf</code>
655          file or on the server command line. The default is
656          <code class="literal">'%m [%p] '</code> which logs a time stamp and the process ID.
657        </p><div class="informaltable"><table class="informaltable" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th>Escape</th><th>Effect</th><th>Session only</th></tr></thead><tbody><tr><td><code class="literal">%a</code></td><td>Application name</td><td>yes</td></tr><tr><td><code class="literal">%u</code></td><td>User name</td><td>yes</td></tr><tr><td><code class="literal">%d</code></td><td>Database name</td><td>yes</td></tr><tr><td><code class="literal">%r</code></td><td>Remote host name or IP address, and remote port</td><td>yes</td></tr><tr><td><code class="literal">%h</code></td><td>Remote host name or IP address</td><td>yes</td></tr><tr><td><code class="literal">%L</code></td><td>Local address (the IP address on the server that the
658              client connected to)</td><td>yes</td></tr><tr><td><code class="literal">%b</code></td><td>Backend type</td><td>no</td></tr><tr><td><code class="literal">%p</code></td><td>Process ID</td><td>no</td></tr><tr><td><code class="literal">%P</code></td><td>Process ID of the parallel group leader, if this process
659               is a parallel query worker</td><td>no</td></tr><tr><td><code class="literal">%t</code></td><td>Time stamp without milliseconds</td><td>no</td></tr><tr><td><code class="literal">%m</code></td><td>Time stamp with milliseconds</td><td>no</td></tr><tr><td><code class="literal">%n</code></td><td>Time stamp with milliseconds (as a Unix epoch)</td><td>no</td></tr><tr><td><code class="literal">%i</code></td><td>Command tag: type of session's current command</td><td>yes</td></tr><tr><td><code class="literal">%e</code></td><td>SQLSTATE error code</td><td>no</td></tr><tr><td><code class="literal">%c</code></td><td>Session ID: see below</td><td>no</td></tr><tr><td><code class="literal">%l</code></td><td>Number of the log line for each session or process, starting at 1</td><td>no</td></tr><tr><td><code class="literal">%s</code></td><td>Process start time stamp</td><td>no</td></tr><tr><td><code class="literal">%v</code></td><td>Virtual transaction ID (procNumber/localXID);  see
660              <a class="xref" href="transaction-id.html" title="67.1. Transactions and Identifiers">Section 67.1</a></td><td>no</td></tr><tr><td><code class="literal">%x</code></td><td>Transaction ID (0 if none is assigned);  see
661              <a class="xref" href="transaction-id.html" title="67.1. Transactions and Identifiers">Section 67.1</a></td><td>no</td></tr><tr><td><code class="literal">%q</code></td><td>Produces no output, but tells non-session
662              processes to stop at this point in the string; ignored by
663              session processes</td><td>no</td></tr><tr><td><code class="literal">%Q</code></td><td>Query identifier of the current query.  Query
664              identifiers are not computed by default, so this field
665              will be zero unless <a class="xref" href="runtime-config-statistics.html#GUC-COMPUTE-QUERY-ID">compute_query_id</a>
666              parameter is enabled or a third-party module that computes
667              query identifiers is configured.</td><td>yes</td></tr><tr><td><code class="literal">%%</code></td><td>Literal <code class="literal">%</code></td><td>no</td></tr></tbody></table></div><p>
668           The backend type corresponds to the column
669           <code class="structfield">backend_type</code> in the view
670           <a class="link" href="monitoring-stats.html#MONITORING-PG-STAT-ACTIVITY-VIEW" title="27.2.3. pg_stat_activity">
671           <code class="structname">pg_stat_activity</code></a>,
672           but additional types can appear
673           in the log that don't show in that view.
674          </p><p>
675          The <code class="literal">%c</code> escape prints a quasi-unique session identifier,
676          consisting of two 4-byte hexadecimal numbers (without leading zeros)
677          separated by a dot.  The numbers are the process start time and the
678          process ID, so <code class="literal">%c</code> can also be used as a space saving way
679          of printing those items.  For example, to generate the session
680          identifier from <code class="literal">pg_stat_activity</code>, use this query:
681 </p><pre class="programlisting">
682 SELECT to_hex(trunc(EXTRACT(EPOCH FROM backend_start))::integer) || '.' ||
683        to_hex(pid)
684 FROM pg_stat_activity;
685 </pre><p>
686
687        </p><div class="tip"><h3 class="title">Tip</h3><p>
688          If you set a nonempty value for <code class="varname">log_line_prefix</code>,
689          you should usually make its last character be a space, to provide
690          visual separation from the rest of the log line.  A punctuation
691          character can be used too.
692         </p></div><div class="tip"><h3 class="title">Tip</h3><p>
693          <span class="application">Syslog</span> produces its own
694          time stamp and process ID information, so you probably do not want to
695          include those escapes if you are logging to <span class="application">syslog</span>.
696         </p></div><div class="tip"><h3 class="title">Tip</h3><p>
697          The <code class="literal">%q</code> escape is useful when including information that is
698          only available in session (backend) context like user or database
699          name.  For example:
700 </p><pre class="programlisting">
701 log_line_prefix = '%m [%p] %q%u@%d/%a '
702 </pre><p>
703         </p></div><div class="note"><h3 class="title">Note</h3><p>
704          The <code class="literal">%Q</code> escape always reports a zero identifier
705          for lines output by <a class="xref" href="runtime-config-logging.html#GUC-LOG-STATEMENT">log_statement</a> because
706          <code class="varname">log_statement</code> generates output before an
707          identifier can be calculated, including invalid statements for
708          which an identifier cannot be calculated.
709         </p></div></dd><dt id="GUC-LOG-LOCK-WAITS"><span class="term"><code class="varname">log_lock_waits</code> (<code class="type">boolean</code>)
710       <a id="id-1.6.6.11.5.3.12.1.3" class="indexterm"></a>
711       </span> <a href="#GUC-LOG-LOCK-WAITS" class="id_link">#</a></dt><dd><p>
712         Controls whether a log message is produced when a session waits
713         longer than <a class="xref" href="runtime-config-locks.html#GUC-DEADLOCK-TIMEOUT">deadlock_timeout</a> to acquire a
714         lock.  This is useful in determining if lock waits are causing
715         poor performance.  The default is <code class="literal">off</code>.
716         Only superusers and users with the appropriate <code class="literal">SET</code>
717         privilege can change this setting.
718        </p></dd><dt id="GUC-LOG-LOCK-FAILURES"><span class="term"><code class="varname">log_lock_failures</code> (<code class="type">boolean</code>)
719       <a id="id-1.6.6.11.5.3.13.1.3" class="indexterm"></a>
720       </span> <a href="#GUC-LOG-LOCK-FAILURES" class="id_link">#</a></dt><dd><p>
721         Controls whether a detailed log message is produced
722         when a lock acquisition fails.  This is useful for analyzing
723         the causes of lock failures.  Currently, only lock failures
724         due to <code class="literal">SELECT NOWAIT</code> is supported.
725         The default is <code class="literal">off</code>.  Only superusers and
726         users with the appropriate <code class="literal">SET</code> privilege
727         can change this setting.
728        </p></dd><dt id="GUC-LOG-RECOVERY-CONFLICT-WAITS"><span class="term"><code class="varname">log_recovery_conflict_waits</code> (<code class="type">boolean</code>)
729       <a id="id-1.6.6.11.5.3.14.1.3" class="indexterm"></a>
730       </span> <a href="#GUC-LOG-RECOVERY-CONFLICT-WAITS" class="id_link">#</a></dt><dd><p>
731         Controls whether a log message is produced when the startup process
732         waits longer than <code class="varname">deadlock_timeout</code>
733         for recovery conflicts.  This is useful in determining if recovery
734         conflicts prevent the recovery from applying WAL.
735        </p><p>
736         The default is <code class="literal">off</code>.  This parameter can only be set
737         in the <code class="filename">postgresql.conf</code> file or on the server
738         command line.
739        </p></dd><dt id="GUC-LOG-PARAMETER-MAX-LENGTH"><span class="term"><code class="varname">log_parameter_max_length</code> (<code class="type">integer</code>)
740       <a id="id-1.6.6.11.5.3.15.1.3" class="indexterm"></a>
741       </span> <a href="#GUC-LOG-PARAMETER-MAX-LENGTH" class="id_link">#</a></dt><dd><p>
742         If greater than zero, each bind parameter value logged with a
743         non-error statement-logging message is trimmed to this many bytes.
744         Zero disables logging of bind parameters for non-error statement logs.
745         <code class="literal">-1</code> (the default) allows bind parameters to be
746         logged in full.
747         If this value is specified without units, it is taken as bytes.
748         Only superusers and users with the appropriate <code class="literal">SET</code>
749         privilege can change this setting.
750        </p><p>
751         This setting only affects log messages printed as a result of
752         <a class="xref" href="runtime-config-logging.html#GUC-LOG-STATEMENT">log_statement</a>,
753         <a class="xref" href="runtime-config-logging.html#GUC-LOG-DURATION">log_duration</a>, and related settings.  Non-zero
754         values of this setting add some overhead, particularly if parameters
755         are sent in binary form, since then conversion to text is required.
756        </p></dd><dt id="GUC-LOG-PARAMETER-MAX-LENGTH-ON-ERROR"><span class="term"><code class="varname">log_parameter_max_length_on_error</code> (<code class="type">integer</code>)
757       <a id="id-1.6.6.11.5.3.16.1.3" class="indexterm"></a>
758       </span> <a href="#GUC-LOG-PARAMETER-MAX-LENGTH-ON-ERROR" class="id_link">#</a></dt><dd><p>
759         If greater than zero, each bind parameter value reported in error
760         messages is trimmed to this many bytes.
761         Zero (the default) disables including bind parameters in error
762         messages.
763         <code class="literal">-1</code> allows bind parameters to be printed in full.
764         If this value is specified without units, it is taken as bytes.
765        </p><p>
766         Non-zero values of this setting add overhead, as
767         <span class="productname">PostgreSQL</span> will need to store textual
768         representations of parameter values in memory at the start of each
769         statement, whether or not an error eventually occurs.  The overhead
770         is greater when bind parameters are sent in binary form than when
771         they are sent as text, since the former case requires data
772         conversion while the latter only requires copying the string.
773        </p></dd><dt id="GUC-LOG-STATEMENT"><span class="term"><code class="varname">log_statement</code> (<code class="type">enum</code>)
774       <a id="id-1.6.6.11.5.3.17.1.3" class="indexterm"></a>
775       </span> <a href="#GUC-LOG-STATEMENT" class="id_link">#</a></dt><dd><p>
776         Controls which SQL statements are logged. Valid values are
777         <code class="literal">none</code> (off), <code class="literal">ddl</code>, <code class="literal">mod</code>, and
778         <code class="literal">all</code> (all statements). <code class="literal">ddl</code> logs all data definition
779         statements, such as <code class="command">CREATE</code>, <code class="command">ALTER</code>, and
780         <code class="command">DROP</code> statements. <code class="literal">mod</code> logs all
781         <code class="literal">ddl</code> statements, plus data-modifying statements
782         such as <code class="command">INSERT</code>,
783         <code class="command">UPDATE</code>, <code class="command">DELETE</code>, <code class="command">TRUNCATE</code>,
784         and <code class="command">COPY FROM</code>.
785         <code class="command">PREPARE</code>, <code class="command">EXECUTE</code>, and
786         <code class="command">EXPLAIN ANALYZE</code> statements are also logged if their
787         contained command is of an appropriate type.  For clients using
788         extended query protocol, logging occurs when an Execute message
789         is received, and values of the Bind parameters are included
790         (with any embedded single-quote marks doubled).
791        </p><p>
792         The default is <code class="literal">none</code>.
793         Only superusers and users with the appropriate <code class="literal">SET</code>
794         privilege can change this setting.
795        </p><div class="note"><h3 class="title">Note</h3><p>
796          Statements that contain simple syntax errors are not logged
797          even by the <code class="varname">log_statement</code> = <code class="literal">all</code> setting,
798          because the log message is emitted only after basic parsing has
799          been done to determine the statement type.  In the case of extended
800          query protocol, this setting likewise does not log statements that
801          fail before the Execute phase (i.e., during parse analysis or
802          planning).  Set <code class="varname">log_min_error_statement</code> to
803          <code class="literal">ERROR</code> (or lower) to log such statements.
804         </p><p>
805          Logged statements might reveal sensitive data and even contain
806          plaintext passwords.
807         </p></div></dd><dt id="GUC-LOG-REPLICATION-COMMANDS"><span class="term"><code class="varname">log_replication_commands</code> (<code class="type">boolean</code>)
808       <a id="id-1.6.6.11.5.3.18.1.3" class="indexterm"></a>
809       </span> <a href="#GUC-LOG-REPLICATION-COMMANDS" class="id_link">#</a></dt><dd><p>
810         Causes each replication command and <code class="literal">walsender</code>
811         process's replication slot acquisition/release to be logged in the
812         server log. See <a class="xref" href="protocol-replication.html" title="54.4. Streaming Replication Protocol">Section 54.4</a> for more
813         information about replication command. The default value is
814         <code class="literal">off</code>. Only superusers and users with the appropriate
815         <code class="literal">SET</code> privilege can change this setting.
816        </p></dd><dt id="GUC-LOG-TEMP-FILES"><span class="term"><code class="varname">log_temp_files</code> (<code class="type">integer</code>)
817       <a id="id-1.6.6.11.5.3.19.1.3" class="indexterm"></a>
818       </span> <a href="#GUC-LOG-TEMP-FILES" class="id_link">#</a></dt><dd><p>
819         Controls logging of temporary file names and sizes.
820         Temporary files can be
821         created for sorts, hashes, and temporary query results.
822         If enabled by this setting, a log entry is emitted for each
823         temporary file, with the file size specified in bytes, when it is deleted.
824         A value of zero logs all temporary file information, while positive
825         values log only files whose size is greater than or equal to
826         the specified amount of data.
827         If this value is specified without units, it is taken as kilobytes.
828         The default setting is -1, which disables such logging.
829         Only superusers and users with the appropriate <code class="literal">SET</code>
830         privilege can change this setting.
831        </p></dd><dt id="GUC-LOG-TIMEZONE"><span class="term"><code class="varname">log_timezone</code> (<code class="type">string</code>)
832       <a id="id-1.6.6.11.5.3.20.1.3" class="indexterm"></a>
833       </span> <a href="#GUC-LOG-TIMEZONE" class="id_link">#</a></dt><dd><p>
834         Sets the time zone used for timestamps written in the server log.
835         Unlike <a class="xref" href="runtime-config-client.html#GUC-TIMEZONE">TimeZone</a>, this value is cluster-wide,
836         so that all sessions will report timestamps consistently.
837         The built-in default is <code class="literal">GMT</code>, but that is typically
838         overridden in <code class="filename">postgresql.conf</code>; <span class="application">initdb</span>
839         will install a setting there corresponding to its system environment.
840         See <a class="xref" href="datatype-datetime.html#DATATYPE-TIMEZONES" title="8.5.3. Time Zones">Section 8.5.3</a> for more information.
841         This parameter can only be set in the <code class="filename">postgresql.conf</code>
842         file or on the server command line.
843        </p></dd></dl></div></div><div class="sect2" id="RUNTIME-CONFIG-LOGGING-CSVLOG"><div class="titlepage"><div><div><h3 class="title">19.8.4. Using CSV-Format Log Output <a href="#RUNTIME-CONFIG-LOGGING-CSVLOG" class="id_link">#</a></h3></div></div></div><p>
844         Including <code class="literal">csvlog</code> in the <code class="varname">log_destination</code> list
845         provides a convenient way to import log files into a database table.
846         This option emits log lines in comma-separated-values
847         (<acronym class="acronym">CSV</acronym>) format,
848         with these columns:
849         time stamp with milliseconds,
850         user name,
851         database name,
852         process ID,
853         client host:port number,
854         session ID,
855         per-session line number,
856         command tag,
857         session start time,
858         virtual transaction ID,
859         regular transaction ID,
860         error severity,
861         SQLSTATE code,
862         error message,
863         error message detail,
864         hint,
865         internal query that led to the error (if any),
866         character count of the error position therein,
867         error context,
868         user query that led to the error (if any and enabled by
869         <code class="varname">log_min_error_statement</code>),
870         character count of the error position therein,
871         location of the error in the PostgreSQL source code
872         (if <code class="varname">log_error_verbosity</code> is set to <code class="literal">verbose</code>),
873         application name, backend type, process ID of parallel group leader,
874         and query id.
875         Here is a sample table definition for storing CSV-format log output:
876
877 </p><pre class="programlisting">
878 CREATE TABLE postgres_log
879 (
880   log_time timestamp(3) with time zone,
881   user_name text,
882   database_name text,
883   process_id integer,
884   connection_from text,
885   session_id text,
886   session_line_num bigint,
887   command_tag text,
888   session_start_time timestamp with time zone,
889   virtual_transaction_id text,
890   transaction_id bigint,
891   error_severity text,
892   sql_state_code text,
893   message text,
894   detail text,
895   hint text,
896   internal_query text,
897   internal_query_pos integer,
898   context text,
899   query text,
900   query_pos integer,
901   location text,
902   application_name text,
903   backend_type text,
904   leader_pid integer,
905   query_id bigint,
906   PRIMARY KEY (session_id, session_line_num)
907 );
908 </pre><p>
909        </p><p>
910         To import a log file into this table, use the <code class="command">COPY FROM</code>
911         command:
912
913 </p><pre class="programlisting">
914 COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
915 </pre><p>
916         It is also possible to access the file as a foreign table, using
917         the supplied <a class="xref" href="file-fdw.html" title="F.15. file_fdw — access data files in the server's file system">file_fdw</a> module.
918        </p><p>
919        There are a few things you need to do to simplify importing CSV log
920        files:
921
922        </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>
923             Set <code class="varname">log_filename</code> and
924             <code class="varname">log_rotation_age</code> to provide a consistent,
925             predictable naming scheme for your log files.  This lets you
926             predict what the file name will be and know when an individual log
927             file is complete and therefore ready to be imported.
928          </p></li><li class="listitem"><p>
929             Set <code class="varname">log_rotation_size</code> to 0 to disable
930             size-based log rotation, as it makes the log file name difficult
931             to predict.
932            </p></li><li class="listitem"><p>
933            Set <code class="varname">log_truncate_on_rotation</code> to <code class="literal">on</code> so
934            that old log data isn't mixed with the new in the same file.
935           </p></li><li class="listitem"><p>
936            The table definition above includes a primary key specification.
937            This is useful to protect against accidentally importing the same
938            information twice.  The <code class="command">COPY</code> command commits all of the
939            data it imports at one time, so any error will cause the entire
940            import to fail.  If you import a partial log file and later import
941            the file again when it is complete, the primary key violation will
942            cause the import to fail.  Wait until the log is complete and
943            closed before importing.  This procedure will also protect against
944            accidentally importing a partial line that hasn't been completely
945            written, which would also cause <code class="command">COPY</code> to fail.
946           </p></li></ol></div><p>
947       </p></div><div class="sect2" id="RUNTIME-CONFIG-LOGGING-JSONLOG"><div class="titlepage"><div><div><h3 class="title">19.8.5. Using JSON-Format Log Output <a href="#RUNTIME-CONFIG-LOGGING-JSONLOG" class="id_link">#</a></h3></div></div></div><p>
948       Including <code class="literal">jsonlog</code> in the
949       <code class="varname">log_destination</code> list provides a convenient way to
950       import log files into many different programs. This option emits log
951       lines in <acronym class="acronym">JSON</acronym> format.
952      </p><p>
953       String fields with null values are excluded from output.
954       Additional fields may be added in the future. User applications that
955       process <code class="literal">jsonlog</code> output should ignore unknown fields.
956      </p><p>
957       Each log line is serialized as a JSON object with the set of keys and
958       their associated values shown in <a class="xref" href="runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-JSONLOG-KEYS-VALUES" title="Table 19.4. Keys and Values of JSON Log Entries">Table 19.4</a>.
959      </p><div class="table" id="RUNTIME-CONFIG-LOGGING-JSONLOG-KEYS-VALUES"><p class="title"><strong>Table 19.4. Keys and Values of JSON Log Entries</strong></p><div class="table-contents"><table class="table" summary="Keys and Values of JSON Log Entries" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th>Key name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><code class="literal">timestamp</code></td><td>string</td><td>Time stamp with milliseconds</td></tr><tr><td><code class="literal">user</code></td><td>string</td><td>User name</td></tr><tr><td><code class="literal">dbname</code></td><td>string</td><td>Database name</td></tr><tr><td><code class="literal">pid</code></td><td>number</td><td>Process ID</td></tr><tr><td><code class="literal">remote_host</code></td><td>string</td><td>Client host</td></tr><tr><td><code class="literal">remote_port</code></td><td>number</td><td>Client port</td></tr><tr><td><code class="literal">session_id</code></td><td>string</td><td>Session ID</td></tr><tr><td><code class="literal">line_num</code></td><td>number</td><td>Per-session line number</td></tr><tr><td><code class="literal">ps</code></td><td>string</td><td>Current ps display</td></tr><tr><td><code class="literal">session_start</code></td><td>string</td><td>Session start time</td></tr><tr><td><code class="literal">vxid</code></td><td>string</td><td>Virtual transaction ID</td></tr><tr><td><code class="literal">txid</code></td><td>string</td><td>Regular transaction ID</td></tr><tr><td><code class="literal">error_severity</code></td><td>string</td><td>Error severity</td></tr><tr><td><code class="literal">state_code</code></td><td>string</td><td>SQLSTATE code</td></tr><tr><td><code class="literal">message</code></td><td>string</td><td>Error message</td></tr><tr><td><code class="literal">detail</code></td><td>string</td><td>Error message detail</td></tr><tr><td><code class="literal">hint</code></td><td>string</td><td>Error message hint</td></tr><tr><td><code class="literal">internal_query</code></td><td>string</td><td>Internal query that led to the error</td></tr><tr><td><code class="literal">internal_position</code></td><td>number</td><td>Cursor index into internal query</td></tr><tr><td><code class="literal">context</code></td><td>string</td><td>Error context</td></tr><tr><td><code class="literal">statement</code></td><td>string</td><td>Client-supplied query string</td></tr><tr><td><code class="literal">cursor_position</code></td><td>number</td><td>Cursor index into query string</td></tr><tr><td><code class="literal">func_name</code></td><td>string</td><td>Error location function name</td></tr><tr><td><code class="literal">file_name</code></td><td>string</td><td>File name of error location</td></tr><tr><td><code class="literal">file_line_num</code></td><td>number</td><td>File line number of the error location</td></tr><tr><td><code class="literal">application_name</code></td><td>string</td><td>Client application name</td></tr><tr><td><code class="literal">backend_type</code></td><td>string</td><td>Type of backend</td></tr><tr><td><code class="literal">leader_pid</code></td><td>number</td><td>Process ID of leader for active parallel workers</td></tr><tr><td><code class="literal">query_id</code></td><td>number</td><td>Query ID</td></tr></tbody></table></div></div><br class="table-break" /></div><div class="sect2" id="RUNTIME-CONFIG-LOGGING-PROC-TITLE"><div class="titlepage"><div><div><h3 class="title">19.8.6. Process Title <a href="#RUNTIME-CONFIG-LOGGING-PROC-TITLE" class="id_link">#</a></h3></div></div></div><p>
960      These settings control how process titles of server processes are
961      modified.  Process titles are typically viewed using programs like
962      <span class="application">ps</span> or, on Windows, <span class="application">Process Explorer</span>.
963      See <a class="xref" href="monitoring-ps.html" title="27.1. Standard Unix Tools">Section 27.1</a> for details.
964     </p><div class="variablelist"><dl class="variablelist"><dt id="GUC-CLUSTER-NAME"><span class="term"><code class="varname">cluster_name</code> (<code class="type">string</code>)
965       <a id="id-1.6.6.11.8.3.1.1.3" class="indexterm"></a>
966       </span> <a href="#GUC-CLUSTER-NAME" class="id_link">#</a></dt><dd><p>
967         Sets a name that identifies this database cluster (instance) for
968         various purposes.  The cluster name appears in the process title for
969         all server processes in this cluster.  Moreover, it is the default
970         application name for a standby connection (see <a class="xref" href="runtime-config-replication.html#GUC-SYNCHRONOUS-STANDBY-NAMES">synchronous_standby_names</a>).
971        </p><p>
972         The name can be any string of less
973         than <code class="symbol">NAMEDATALEN</code> characters (64 characters in a standard
974         build). Only printable ASCII characters may be used in the
975         <code class="varname">cluster_name</code> value.
976         Other characters are replaced with <a class="link" href="sql-syntax-lexical.html#SQL-SYNTAX-STRINGS-ESCAPE" title="4.1.2.2. String Constants with C-Style Escapes">C-style hexadecimal escapes</a>.
977         No name is shown if this parameter is set to the empty string
978         <code class="literal">''</code> (which is the default).
979         This parameter can only be set at server start.
980        </p></dd><dt id="GUC-UPDATE-PROCESS-TITLE"><span class="term"><code class="varname">update_process_title</code> (<code class="type">boolean</code>)
981       <a id="id-1.6.6.11.8.3.2.1.3" class="indexterm"></a>
982       </span> <a href="#GUC-UPDATE-PROCESS-TITLE" class="id_link">#</a></dt><dd><p>
983         Enables updating of the process title every time a new SQL command
984         is received by the server.
985         This setting defaults to <code class="literal">on</code> on most platforms, but it
986         defaults to <code class="literal">off</code> on Windows due to that platform's larger
987         overhead for updating the process title.
988         Only superusers and users with the appropriate <code class="literal">SET</code>
989         privilege can change this setting.
990        </p></dd></dl></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="runtime-config-query.html" title="19.7. Query Planning">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="runtime-config.html" title="Chapter 19. Server Configuration">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="runtime-config-statistics.html" title="19.9. Run-time Statistics">Next</a></td></tr><tr><td width="40%" align="left" valign="top">19.7. Query Planning </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 19.9. Run-time Statistics</td></tr></table></div></body></html>