log_line_prefix

There are three basic formats of line prefix that will match the standard of sorts introduced by the requirements of pgFouine, a popular log parsing utility covered next. To ensure compatibility with that tool, you should use one of these three in your postgresql.conf, if you don't have any specific reason not to:

  • log_line_prefix = '%t [%p]: [%l-1] '
  • log_line_prefix = '%t [%p]: [%l-1] user=%u,db=%d '
  • log_line_prefix = '%t [%p]: [%l-1] user=%u,db=%d,remote=%r '

Note the trailing space in all these examples; that is important to always include in your prefix setting. The first line just logs basic information. The second upgrades that to also include the user and database information for the connection, which allows filtering ...

Get PostgreSQL 10 High Performance now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.