Attached also is a patch to comments in sample postgresql.conf file.

Subject: [PATCHES]  log_line_prefix additions
Date: Wednesday August 25 2004 3:26
From: "Ed L." <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]

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>
*** src/backend/utils/misc/postgresql.conf.sample.orig	2004-08-25 16:01:19.000000000 -0600
--- src/backend/utils/misc/postgresql.conf.sample	2004-08-25 16:02:04.000000000 -0600
***************
*** 225,227 ****
--- 225,229 ----
  				# %r=remote host and port
+ 				# %h=remote host %P=port
  				# %p=PID %t=timestamp %i=command tag
+ 				# %m=timestamp with milliseconds
  				# %c=session id %l=session line number
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Reply via email to