This patch against 8.0.0beta1 source adds log_line_prefix options for
millisecond timestamps (%m) and remote host (%h). The milliseconds are useful for QPS measurements. Ed L.
This commit is contained in:
parent
7974c35020
commit
6c2ba14d8d
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
$PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.322 2005/06/04 20:42:41 momjian Exp $
|
$PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.323 2005/06/09 22:29:52 momjian Exp $
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<chapter Id="runtime">
|
<chapter Id="runtime">
|
||||||
@ -2829,6 +2829,11 @@ archive_command = 'copy "%p" /mnt/server/archivedir/"%f"' # Windows
|
|||||||
<entry>Remote host name or IP address, and remote port</entry>
|
<entry>Remote host name or IP address, and remote port</entry>
|
||||||
<entry>yes</entry>
|
<entry>yes</entry>
|
||||||
</row>
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry><literal>%h</literal></entry>
|
||||||
|
<entry>Remote Hostname or IP address</entry>
|
||||||
|
<entry>yes</entry>
|
||||||
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry><literal>%p</literal></entry>
|
<entry><literal>%p</literal></entry>
|
||||||
<entry>Process ID</entry>
|
<entry>Process ID</entry>
|
||||||
@ -2839,6 +2844,11 @@ archive_command = 'copy "%p" /mnt/server/archivedir/"%f"' # Windows
|
|||||||
<entry>Time stamp</entry>
|
<entry>Time stamp</entry>
|
||||||
<entry>no</entry>
|
<entry>no</entry>
|
||||||
</row>
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry><literal>%m</literal></entry>
|
||||||
|
<entry>Timestamp with milliseconds</entry>
|
||||||
|
<entry>no</entry>
|
||||||
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry><literal>%i</literal></entry>
|
<entry><literal>%i</literal></entry>
|
||||||
<entry>Command tag: This is the command that generated the log line.</entry>
|
<entry>Command tag: This is the command that generated the log line.</entry>
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.158 2005/03/12 01:54:44 tgl Exp $
|
* $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.159 2005/06/09 22:29:52 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -1375,6 +1375,33 @@ log_line_prefix(StringInfo buf)
|
|||||||
case 'l':
|
case 'l':
|
||||||
appendStringInfo(buf, "%ld", log_line_number);
|
appendStringInfo(buf, "%ld", log_line_number);
|
||||||
break;
|
break;
|
||||||
|
case 'm':
|
||||||
|
{
|
||||||
|
time_t stamp_time;
|
||||||
|
char strfbuf[128], msbuf[5];
|
||||||
|
struct timeval tv;
|
||||||
|
|
||||||
|
gettimeofday(&tv, NULL);
|
||||||
|
stamp_time = tv.tv_sec;
|
||||||
|
|
||||||
|
strftime(strfbuf, sizeof(strfbuf),
|
||||||
|
/* leave room for milliseconds... */
|
||||||
|
/* Win32 timezone names are too long so don't print them. */
|
||||||
|
#ifndef WIN32
|
||||||
|
"%Y-%m-%d %H:%M:%S %Z",
|
||||||
|
#else
|
||||||
|
"%Y-%m-%d %H:%M:%S ",
|
||||||
|
#endif
|
||||||
|
localtime(&stamp_time));
|
||||||
|
|
||||||
|
/* 'paste' milliseconds into place... */
|
||||||
|
sprintf(msbuf, ".%03d",
|
||||||
|
(int)(tv.tv_usec/1000));
|
||||||
|
strncpy(strfbuf+19, msbuf, 4);
|
||||||
|
|
||||||
|
appendStringInfoString(buf, strfbuf);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -1426,6 +1453,10 @@ log_line_prefix(StringInfo buf)
|
|||||||
MyProcPort->remote_port);
|
MyProcPort->remote_port);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'h':
|
||||||
|
if (MyProcPort)
|
||||||
|
appendStringInfo(buf, "%s", MyProcPort->remote_host);
|
||||||
|
break;
|
||||||
case 'q':
|
case 'q':
|
||||||
/* in postmaster and friends, stop if %q is seen */
|
/* in postmaster and friends, stop if %q is seen */
|
||||||
/* in a backend, just ignore */
|
/* in a backend, just ignore */
|
||||||
|
@ -241,8 +241,9 @@
|
|||||||
#log_duration = false
|
#log_duration = false
|
||||||
#log_line_prefix = '' # e.g. '<%u%%%d> '
|
#log_line_prefix = '' # e.g. '<%u%%%d> '
|
||||||
# %u=user name %d=database name
|
# %u=user name %d=database name
|
||||||
# %r=remote host and port
|
# %r=remote host and port %h=remote host
|
||||||
# %p=PID %t=timestamp %i=command tag
|
# %p=PID %t=timestamp %i=command tag
|
||||||
|
# %m=timestamp with milliseconds
|
||||||
# %c=session id %l=session line number
|
# %c=session id %l=session line number
|
||||||
# %s=session start timestamp %x=transaction id
|
# %s=session start timestamp %x=transaction id
|
||||||
# %q=stop here in non-session processes
|
# %q=stop here in non-session processes
|
||||||
|
Loading…
x
Reference in New Issue
Block a user