Allow cluster_name in log_line_prefix

Started by Craig Ringerabout 6 years ago7 messages
#1Craig Ringer
craig@2ndquadrant.com

Hi folks

I was recently surprised to notice that log_line_prefix doesn't support a
cluster_name placeholder. I suggest adding one. If I don't hear objections
I'll send a patch.

Before anyone asks "but why?!":

* A constant (short) string in log_line_prefix is immensely useful when
working with logs from multi-node systems. Whether that's physical
streaming replication, logical replication, Citus, whatever, it doesn't
matter. It's worth paying the small storage price for sanity when looking
at logs.

* Yes you can embed it directly into log_line_prefix. But then it gets
copied by pg_basebackup or whatever you're using to clone standbys etc, so
you can easily land up with multiple instances reporting the same name.
This rather defeats the purpose.

--
Craig Ringer http://www.2ndQuadrant.com/
2ndQuadrant - PostgreSQL Solutions for the Enterprise

#2Thomas Munro
thomas.munro@gmail.com
In reply to: Craig Ringer (#1)
Re: Allow cluster_name in log_line_prefix

On Mon, Oct 28, 2019 at 3:33 PM Craig Ringer <craig@2ndquadrant.com> wrote:

I was recently surprised to notice that log_line_prefix doesn't support a cluster_name placeholder. I suggest adding one. If I don't hear objections I'll send a patch.

+1

#3Tatsuo Ishii
ishii@sraoss.co.jp
In reply to: Craig Ringer (#1)
Re: Allow cluster_name in log_line_prefix

Hi folks

I was recently surprised to notice that log_line_prefix doesn't support a
cluster_name placeholder. I suggest adding one. If I don't hear objections
I'll send a patch.

I think it'd be a good thing for users.

Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp

#4Fujii Masao
masao.fujii@gmail.com
In reply to: Craig Ringer (#1)
Re: Allow cluster_name in log_line_prefix

On Mon, Oct 28, 2019 at 1:33 PM Craig Ringer <craig@2ndquadrant.com> wrote:

Hi folks

I was recently surprised to notice that log_line_prefix doesn't support a cluster_name placeholder. I suggest adding one. If I don't hear objections I'll send a patch.

If we do this, cluster_name should be included in csvlog?

Regards,

--
Fujii Masao

#5Andres Freund
andres@anarazel.de
In reply to: Craig Ringer (#1)
Re: Allow cluster_name in log_line_prefix

Hi,

On 2019-10-28 12:33:00 +0800, Craig Ringer wrote:

I was recently surprised to notice that log_line_prefix doesn't support a
cluster_name placeholder. I suggest adding one. If I don't hear objections
I'll send a patch.

Before anyone asks "but why?!":

* A constant (short) string in log_line_prefix is immensely useful when
working with logs from multi-node systems. Whether that's physical
streaming replication, logical replication, Citus, whatever, it doesn't
matter. It's worth paying the small storage price for sanity when looking
at logs.

* Yes you can embed it directly into log_line_prefix. But then it gets
copied by pg_basebackup or whatever you're using to clone standbys etc, so
you can easily land up with multiple instances reporting the same name.
This rather defeats the purpose.

+1. For a while this was part of the patch that added cluster_name
(possibly worthwhile digging it up from that thread), but some people
thought it was unnecessary, so it was excised from the patch to get the
basic feature...

Greetings,

Andres Freund

#6Vik Fearing
vik.fearing@2ndquadrant.com
In reply to: Fujii Masao (#4)
Re: Allow cluster_name in log_line_prefix

On 31/10/2019 08:47, Fujii Masao wrote:

On Mon, Oct 28, 2019 at 1:33 PM Craig Ringer <craig@2ndquadrant.com> wrote:

Hi folks

I was recently surprised to notice that log_line_prefix doesn't support a cluster_name placeholder. I suggest adding one. If I don't hear objections I'll send a patch.

If we do this, cluster_name should be included in csvlog?

Yes, absolutely.

--

Vik Fearing

#7Craig Ringer
craig@2ndquadrant.com
In reply to: Vik Fearing (#6)
Re: Allow cluster_name in log_line_prefix

On Sun, 3 Nov 2019 at 07:22, Vik Fearing <vik.fearing@2ndquadrant.com>
wrote:

On 31/10/2019 08:47, Fujii Masao wrote:

On Mon, Oct 28, 2019 at 1:33 PM Craig Ringer <craig@2ndquadrant.com>

wrote:

Hi folks

I was recently surprised to notice that log_line_prefix doesn't support

a cluster_name placeholder. I suggest adding one. If I don't hear
objections I'll send a patch.

If we do this, cluster_name should be included in csvlog?

Yes, absolutely.

Ok, I can put that together soon then.

I don't think it's too likely that people will shout about it being added
to csvlog. People using csvlog tend to be ingesting and postprocessing
their logs anyway. Plus gzip is really, really good at dealing with
redundancy.

--
Craig Ringer http://www.2ndQuadrant.com/
2ndQuadrant - PostgreSQL Solutions for the Enterprise