This patch against 8.0.0beta1 source adds log_line_prefix options for millisecond timestamps (%m), remote host (%h), and remote port (%P). The milliseconds are useful for QPS measurements, and the remote port is worthless to us as part of %r.
*** src/backend/utils/error/elog.c.orig 2004-08-25 12:37:26.000000000 -0600 --- src/backend/utils/error/elog.c 2004-08-25 15:05:34.000000000 -0600 *************** *** 1347,1348 **** --- 1347,1370 ---- break; + case 'm': + { + time_t stamp_time; + char strfbuf[128]; + struct timeval tv; + struct timezone tz = {0, 0}; + + gettimeofday(&tv, &tz); + stamp_time = tv.tv_sec; + + /* leave room for milliseconds... */ + strftime(strfbuf, sizeof(strfbuf), + "%Y-%m-%d %H:%M:%S %Z", + localtime(&stamp_time)); + + /* 'paste' milliseconds into place... */ + sprintf(strfbuf+19, ".%03d", + (int)(tv.tv_usec/1000)); + + appendStringInfoString(buf, strfbuf); + } + break; case 't': *************** *** 1394,1395 **** --- 1416,1430 ---- } + case 'h': + if (MyProcPort) + { + appendStringInfo(buf, "%s", MyProcPort->remote_host); + } + break; + case 'P': + if (MyProcPort) + { + if (strlen(MyProcPort->remote_port) > 0) + appendStringInfo(buf, "%s", + MyProcPort->remote_port); + } break;
*** ./doc/src/sgml/runtime.sgml.orig 2004-08-25 15:11:39.000000000 -0600 --- ./doc/src/sgml/runtime.sgml 2004-08-25 15:13:29.000000000 -0600 *************** *** 2304,2305 **** --- 2304,2315 ---- <row> + <entry><literal>%h</literal></entry> + <entry>Remote Hostname or IP address</entry> + <entry>Yes</entry> + </row> + <row> + <entry><literal>%P</literal></entry> + <entry>Remote Port</entry> + <entry>Yes</entry> + </row> + <row> <entry><literal>%p</literal></entry> *************** *** 2314,2315 **** --- 2324,2330 ---- <row> + <entry><literal>%m</literal></entry> + <entry>Timestamp with milliseconds</entry> + <entry>No</entry> + </row> + <row> <entry><literal>%i</literal></entry>
---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html