Re: Add support for logging the current role

Itagaki Takahiro <itagaki.takahiro@gmail.com>

From: Itagaki Takahiro <itagaki.takahiro@gmail.com>
To: Stephen Frost <sfrost@snowman.net>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2011-02-01T11:48:30Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Add support for an application_name parameter, which is displayed in

  2. Make CSV column ordering a bit more logical.

  3. Extend the format of CSV logs to include the additional information supplied

  4. Add virtual transaction IDs to CSVLOG output, so that messages coming from

  5. Provide for logfiles in machine readable CSV format. In consequence, rename

> Updated patch attached.

I think we need to improve postgresql.conf.sample a bit more, especially
the long line for #log_csv_fields = '...'. 330 characters in it!
  #1. Leave the long line because it is needed.
  #2. Hide the variable from the default conf.
  #3. Use short %x mnemonic both in log_line_prefix and log_csv_fields.
      (It might require many additional mnemonics.)
Which is better, or another idea?

On Sat, Jan 29, 2011 at 13:06, Stephen Frost <sfrost@snowman.net> wrote:
>> * log_csv_fields's GUC context is PGC_POSTMASTER. Is it by design?
>
> Doing SIGHUP would require addressing how to get all of the backends to
> close the old log file and open the new one, because we don't want to
> have a given log file which has two different CSV formats in it (we
> wouldn't be able to load it into the database...).  This was
> specifically addressed in the thread leading up to this patch...

I think it depends default log filename, that contains %S (seconds)
suffix. We can remove %S from log_filename; if we use a log per-day,
those log might contain different columns even after restart. If we
cannot avoid zigged csv fields completely, SIGHUP seems reasonable for it.

>> * What objects do you want to allocate in TopMemoryContext in
>>   assign_log_csv_fields() ?
> I just moved the switch to Top to be after those are allocated.

How about changing the type of csv_log_fields from List* to fixed
array of LogCSVFields? If so, we can use an array-initializer
instead of build_default_csvlog_list() ?  The code will be simplified.
Fixed length won't be a problem because it would be rare that the
same field are specified many times.

>> * Docs need some tags for itemized elements or pre-formatted codes.
>>   They looks itemized in the sgml files, but will be flattened in
>>   complied HTML files.
>
> Not sure what you're referring to here...?  Can you elaborate?  I'm not
> great with the docs. :/

Could you try to "make html" in the doc directory?
Your new decumentation after
| These columns may be included in the CSV output:
will be unaligned plain text without some tags.

-- 
Itagaki Takahiro