Re: [PATCHES] log_line_prefix additions

2005-06-04 Thread Bruce Momjian

Patch additions added to the patch queue.

---


Andrew Dunstan wrote:
 
 
 Ed L. wrote:
 
 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: pgsql-patches@postgresql.org
 
 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.
 
   
 
 [snip]
 
 +struct timezone tz = {0, 0};
 + 
 +gettimeofday(tv, tz);
   
 
 
 
 
 
 The timezone is pointless. Just pass NULL as the second argument to 
 gettimeofday().
 
 Also, I don't understand what you mean by the remote port being 
 worthless to us as part of %r. Please explain.
 
 cheers
 
 andrew
 
 
 
 ---(end of broadcast)---
 TIP 8: explain analyze is your friend
 

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  pgman@candle.pha.pa.us   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073

---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings


Re: [PATCHES] log_line_prefix additions

2004-08-28 Thread Bruce Momjian

This has been saved for the 8.1 release:

http:/momjian.postgresql.org/cgi-bin/pgpatches2

---

Ed L. wrote:
 
 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.
 
 

[ Attachment, skipping... ]

[ Attachment, skipping... ]

 
 ---(end of broadcast)---
 TIP 5: Have you checked our extensive FAQ?
 
http://www.postgresql.org/docs/faqs/FAQ.html

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073

---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
  subscribe-nomail command to [EMAIL PROTECTED] so that your
  message can get through to the mailing list cleanly


[PATCHES] log_line_prefix additions

2004-08-25 Thread Ed L.

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.0 -0600
--- src/backend/utils/error/elog.c	2004-08-25 15:05:34.0 -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.0 -0600
--- ./doc/src/sgml/runtime.sgml	2004-08-25 15:13:29.0 -0600
***
*** 2304,2305 
--- 2304,2315 
  	row
+ 	 entryliteral%h/literal/entry
+ 	 entryRemote Hostname or IP address/entry
+ 	 entryYes/entry
+ 	/row
+ 	row
+ 	 entryliteral%P/literal/entry
+ 	 entryRemote Port/entry
+ 	 entryYes/entry
+ 	/row
+ 	row
  	 entryliteral%p/literal/entry
***
*** 2314,2315 
--- 2324,2330 
  	row
+ 	 entryliteral%m/literal/entry
+ 	 entryTimestamp with milliseconds/entry
+ 	 entryNo/entry
+ 	/row
+ 	row
  	 entryliteral%i/literal/entry

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faqs/FAQ.html


Re: [PATCHES] log_line_prefix additions

2004-08-25 Thread Ed L.
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.0 -0600
--- src/backend/utils/error/elog.c	2004-08-25 15:05:34.0 -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.0 -0600
--- ./doc/src/sgml/runtime.sgml	2004-08-25 15:13:29.0 -0600
***
*** 2304,2305 
--- 2304,2315 
  	row
+ 	 entryliteral%h/literal/entry
+ 	 entryRemote Hostname or IP address/entry
+ 	 entryYes/entry
+ 	/row
+ 	row
+ 	 entryliteral%P/literal/entry
+ 	 entryRemote Port/entry
+ 	 entryYes/entry
+ 	/row
+ 	row
  	 entryliteral%p/literal/entry
***
*** 2314,2315 
--- 2324,2330 
  	row
+ 	 entryliteral%m/literal/entry
+ 	 entryTimestamp with milliseconds/entry
+ 	 entryNo/entry
+ 	/row
+ 	row
  	 entryliteral%i/literal/entry
*** src/backend/utils/misc/postgresql.conf.sample.orig	2004-08-25 16:01:19.0 -0600
--- src/backend/utils/misc/postgresql.conf.sample	2004-08-25 16:02:04.0 -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])


Re: [PATCHES] log_line_prefix additions

2004-08-25 Thread Andrew Dunstan

Ed L. wrote:
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.
 

[snip]
+ 	struct timezone tz = {0, 0};
+ 
+ 	gettimeofday(tv, tz);
 



The timezone is pointless. Just pass NULL as the second argument to 
gettimeofday().

Also, I don't understand what you mean by the remote port being 
worthless to us as part of %r. Please explain.

cheers
andrew

---(end of broadcast)---
TIP 8: explain analyze is your friend


Re: [PATCHES] log_line_prefix additions

2004-08-25 Thread Ed L.
On Wednesday August 25 2004 4:25, Andrew Dunstan wrote:
 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.

 [snip]

 I don't understand what you mean by the remote port being
 worthless to us as part of %r. Please explain.

Worthless to us as part of %r means we don't use the remote port, and 
would rather not have it in our logs.  With %h, we can log what we want 
(hostname/IP), and others can still get both ip and port if they like with 
%h(%P) or %r.

Ed


---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send unregister YourEmailAddressHere to [EMAIL PROTECTED])