log_line_prefix additions

Started by Ed L.almost 22 years ago7 messagespatches
Jump to latest
#1Ed L.
pgsql@bluepolka.net

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.

Attachments:

elog.c.difftext/x-diff; charset=us-ascii; name=elog.c.diffDownload+35-0
runtime.sgml.difftext/x-diff; charset=us-ascii; name=runtime.sgml.diffDownload+15-0
#2Ed L.
pgsql@bluepolka.net
In reply to: Ed L. (#1)
Re: log_line_prefix additions

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." <pgsql@bluepolka.net>
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.

-------------------------------------------------------

Attachments:

elog.c.difftext/x-diff; charset=us-ascii; name=elog.c.diffDownload+35-0
runtime.sgml.difftext/x-diff; charset=us-ascii; name=runtime.sgml.diffDownload+15-0
postgresql.conf.sample.difftext/x-diff; charset=iso-8859-1; name=postgresql.conf.sample.diffDownload+2-0
#3Andrew Dunstan
andrew@dunslane.net
In reply to: Ed L. (#2)
Re: log_line_prefix additions

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." <pgsql@bluepolka.net>
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

#4Ed L.
pgsql@bluepolka.net
In reply to: Andrew Dunstan (#3)
Re: log_line_prefix additions

On Wednesday August 25 2004 4:25, Andrew Dunstan wrote:

From: "Ed L." <pgsql@bluepolka.net>

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]

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

#5Bruce Momjian
bruce@momjian.us
In reply to: Ed L. (#1)
Re: log_line_prefix additions

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
  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
#6Bruce Momjian
bruce@momjian.us
In reply to: Andrew Dunstan (#3)
Re: log_line_prefix additions

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." <pgsql@bluepolka.net>
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
#7Bruce Momjian
bruce@momjian.us
In reply to: Ed L. (#2)
Re: log_line_prefix additions

qEd 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." <pgsql@bluepolka.net>
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.

OK, I have modified your patch and applied it. I changed gettimeofday()
to use NULL for timezone, as suggested by Andrew Dunstan. I also
modified the code to not print the very long timezone name on Win32,
just as we do with the current non-millisecond timezone example.

Because we already have a remote host and port specification, it seems
unnecessary to add a remote port only specification. I have removed the
%P/port part of your patch, so we have %r host/port and $h host-only.

One other approach would be to remove %r host/port, but %r has some
smarts about not printing the remote port number of it isn't available
(like unix sockets), and the remote port alone seems meaningless, so
this direction seems best.

(Some of these ideas are mine, some are Tom's.)

-- 
  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

Attachments:

/bjm/difftext/plainDownload+44-2