Обсуждение: [GENERAL] Postgres 9.6.2 and pg_log

Поиск
Список
Период
Сортировка

[GENERAL] Postgres 9.6.2 and pg_log

От
Mark Watson
Дата:

Good day all,

 

I just noticed an anomaly regarding the logging. I have my logging set up as follows:

log_filename = 'postgresql-%d.log'

log_truncate_on_rotation = on

 

My log file postgresql-21.log contains only entries for today (April 24). When I restart the service, entries correctly start accumulating in postgresql-24.log.  For example, my postgresql-21.log contains:

2017-04-24 11:19:34 EDT LOG:  received fast shutdown request

2017-04-24 11:19:34 EDT LOG:  aborting any active transactions

2017-04-24 11:19:34 EDT LOG:  autovacuum launcher shutting down

2017-04-24 11:19:35 EDT LOG:  shutting down

2017-04-24 11:19:35 EDT LOG:  database system is shut down

 

My postgresql-24.log contains:

2017-04-24 11:19:40 EDT LOG:  database system was shut down at 2017-04-24 11:19:35 EDT

2017-04-24 11:19:40 EDT LOG:  MultiXact member wraparound protections are now enabled

2017-04-24 11:19:40 EDT LOG:  database system is ready to accept connections

2017-04-24 11:19:40 EDT LOG:  autovacuum launcher started

 

This is on Windows 10, 64-bit

PostgreSQL 9.2.2, compiled by Visual C++ build 1800, 64-bit

(EnterpriseDB installer)

 

Note that this is not a major concern on my end; postgres 9.6.2 has otherwise been running flawlessly.

 

Mark Watson

 

 

 

 

Re: [GENERAL] Postgres 9.6.2 and pg_log

От
"David G. Johnston"
Дата:
On Mon, Apr 24, 2017 at 8:43 AM, Mark Watson <mark.watson@jurisconcept.ca> wrote:

Good day all,

 

I just noticed an anomaly regarding the logging. I have my logging set up as follows:

log_filename = 'postgresql-%d.log'

log_truncate_on_rotation = on


​I don't see "log_rotation_age" and/or "log_rotation_size" here [1] and at least one needs to be set in order to enable actual rotation; the "truncate" option simply tells PostgreSQL what to do when encountering a file with the same name during the rotation process.​

log_rotation_age apparently has under-documented intelligence since I would expect a server that starts up mid-hour and uses a 60 minute rotation to rotate mid-hour as well so the log would contain 1 hours worth of data but the leading hours would be different.  The examples in log_truncate_on_rotation indicate that this isn't the case.  I have not tested reality or read the source.

This is on Windows 10, 64-bit

PostgreSQL 9.2.2, compiled by Visual C++ build 1800, 64-bit

(EnterpriseDB installer)

 

Note that this is not a major concern on my end; postgres 9.6.2 has otherwise been running flawlessly.



​Um...you're reporting a very outdated 9.2 release in the supposed copy-paste job above but claiming 9.6.2 ...


David J.

Re: [GENERAL] Postgres 9.6.2 and pg_log

От
Mark Watson
Дата:

 

 

De : David G. Johnston [mailto:david.g.johnston@gmail.com]
Envoyé : Monday, April 24, 2017 1:34 PM
À : Mark Watson
Cc : (pgsql-general@postgresql.org)
Objet : Re: [GENERAL] Postgres 9.6.2 and pg_log

 

On Mon, Apr 24, 2017 at 8:43 AM, Mark Watson <mark.watson@jurisconcept.ca> wrote:

Good day all,

 

I just noticed an anomaly regarding the logging. I have my logging set up as follows:

log_filename = 'postgresql-%d.log'

log_truncate_on_rotation = on

 

​I don't see "log_rotation_age" and/or "log_rotation_size" here [1] and at least one needs to be set in order to enable actual rotation; the "truncate" option simply tells PostgreSQL what to do when encountering a file with the same name during the rotation process.​

 

log_rotation_age apparently has under-documented intelligence since I would expect a server that starts up mid-hour and uses a 60 minute rotation to rotate mid-hour as well so the log would contain 1 hours worth of data but the leading hours would be different.  The examples in log_truncate_on_rotation indicate that this isn't the case.  I have not tested reality or read the source.

 

This is on Windows 10, 64-bit

PostgreSQL 9.2.2, compiled by Visual C++ build 1800, 64-bit

(EnterpriseDB installer)

 

Note that this is not a major concern on my end; postgres 9.6.2 has otherwise been running flawlessly.

 

 

​Um...you're reporting a very outdated 9.2 release in the supposed copy-paste job above but claiming 9.6.2 ...

 

 

David J.

 

Thanks, David,

The lines log_rotation_age and log_rotation_size are commented, and currently are:

#log_rotation_age = 1d                                 # Automatic rotation of logfiles will

                                                                                # happen after that time.  0 disables.

#log_rotation_size = 10MB                          # Automatic rotation of logfiles will

                                                                                # happen after that much log output.

                                                                                # 0 disables.

 

 

I see from your reference article that the log_rotation_age is now in minutes, and I will adjust that to 1440 (1 day). I don’t know where the “1d” came from. I know it used to be like this in earlier versions.

 

Mark Watson

Re: [GENERAL] Postgres 9.6.2 and pg_log

От
Mark Watson
Дата:

 

De : David G. Johnston [mailto:david.g.johnston@gmail.com]
Envoyé : Monday, April 24, 2017 1:34 PM
À : Mark Watson
Cc : (pgsql-general@postgresql.org)
Objet : Re: [GENERAL] Postgres 9.6.2 and pg_log

 

On Mon, Apr 24, 2017 at 8:43 AM, Mark Watson <mark.watson@jurisconcept.ca> wrote:

Good day all,

 

I just noticed an anomaly regarding the logging. I have my logging set up as follows:

log_filename = 'postgresql-%d.log'

log_truncate_on_rotation = on

 

​I don't see "log_rotation_age" and/or "log_rotation_size" here [1] and at least one needs to be set in order to enable actual rotation; the "truncate" option simply tells PostgreSQL what to do when encountering a file with the same name during the rotation process.​

 

log_rotation_age apparently has under-documented intelligence since I would expect a server that starts up mid-hour and uses a 60 minute rotation to rotate mid-hour as well so the log would contain 1 hours worth of data but the leading hours would be different.  The examples in log_truncate_on_rotation indicate that this isn't the case.  I have not tested reality or read the source.

 

This is on Windows 10, 64-bit

PostgreSQL 9.2.2, compiled by Visual C++ build 1800, 64-bit

(EnterpriseDB installer)

 

Note that this is not a major concern on my end; postgres 9.6.2 has otherwise been running flawlessly.

 

 

​Um...you're reporting a very outdated 9.2 release in the supposed copy-paste job above but claiming 9.6.2 ...

 

 

David J.

Sorry about the version; I queried SELECT version() in pgAdmin4 and did not copy/paste the results. It is version 9.6.2.

Re: [GENERAL] Postgres 9.6.2 and pg_log

От
"David G. Johnston"
Дата:
On Mon, Apr 24, 2017 at 10:58 AM, Mark Watson <mark.watson@jurisconcept.ca> wrote:


The lines log_rotation_age and log_rotation_size are commented, and currently are:

#log_rotation_age = 1d                                 # Automatic rotation of logfiles will

                                                                                # happen after that time.  0 disables.

#log_rotation_size = 10MB                          # Automatic rotation of logfiles will

                                                                                # happen after that much log output.

                                                                                # 0 disables.

 

 

I see from your reference article that the log_rotation_age is now in minutes, and I will adjust that to 1440 (1 day). I don’t know where the “1d” came from. I know it used to be like this in earlier versions.



​Those are fine:  See "Numeric with Unit" @​


​I think the actual missing, and (just checked) defaulted off, parameter is "logging_collector"

David J.

Re: [GENERAL] Postgres 9.6.2 and pg_log

От
Mark Watson
Дата:

De : David G. Johnston [mailto:david.g.johnston@gmail.com]
Envoyé : Monday, April 24, 2017 2:18 PM
À : Mark Watson
Cc : (pgsql-general@postgresql.org)
Objet : Re: [GENERAL] Postgres 9.6.2 and pg_log

 

On Mon, Apr 24, 2017 at 10:58 AM, Mark Watson <mark.watson@jurisconcept.ca> wrote:

 

The lines log_rotation_age and log_rotation_size are commented, and currently are:

#log_rotation_age = 1d                                 # Automatic rotation of logfiles will

                                                                                # happen after that time.  0 disables.

#log_rotation_size = 10MB                          # Automatic rotation of logfiles will

                                                                                # happen after that much log output.

                                                                                # 0 disables.

 

 

I see from your reference article that the log_rotation_age is now in minutes, and I will adjust that to 1440 (1 day). I don’t know where the “1d” came from. I know it used to be like this in earlier versions.

 

 

​Those are fine:  See "Numeric with Unit" @​

 

 

​I think the actual missing, and (just checked) defaulted off, parameter is "logging_collector"

 

David J.

I have (copy/paste) :

log_destination = 'stderr'                             # Valid values are combinations of

                                                                                # stderr, csvlog, syslog, and eventlog,

                                                                                # depending on platform.  csvlog

                                                                                # requires logging_collector to be on.

 

# This is used when logging to stderr:

logging_collector = on                    # Enable capturing of stderr and csvlog

                                                                                # into log files. Required to be on for

                                                                                # csvlogs.

                                                                                # (change requires restart)

 

Mark Watson

Re: [GENERAL] Postgres 9.6.2 and pg_log

От
"David G. Johnston"
Дата:
On Mon, Apr 24, 2017 at 11:27 AM, Mark Watson <mark.watson@jurisconcept.ca> wrote:


log_destination = 'stderr'                             # Valid values are combinations of

                                                                                # stderr, csvlog, syslog, and eventlog,

                                                                                # depending on platform.  csvlog

                                                                                # requires logging_collector to be on.

 

# This is used when logging to stderr:

logging_collector = on                    # Enable capturing of stderr and csvlog

                                                                                # into log files. Required to be on for

                                                                                # csvlogs.

                                                                                # (change requires restart)



​I'm out of ideas...

David J.​

Re: [GENERAL] Postgres 9.6.2 and pg_log

От
Mark Watson
Дата:

 

De : David G. Johnston [mailto:david.g.johnston@gmail.com]
Envoyé : Monday, April 24, 2017 3:15 PM
À : Mark Watson
Cc : (pgsql-general@postgresql.org)
Objet : Re: [GENERAL] Postgres 9.6.2 and pg_log

 

On Mon, Apr 24, 2017 at 11:27 AM, Mark Watson <mark.watson@jurisconcept.ca> wrote:

 

log_destination = 'stderr'                             # Valid values are combinations of

                                                                                # stderr, csvlog, syslog, and eventlog,

                                                                                # depending on platform.  csvlog

                                                                                # requires logging_collector to be on.

 

# This is used when logging to stderr:

logging_collector = on                    # Enable capturing of stderr and csvlog

                                                                                # into log files. Required to be on for

                                                                                # csvlogs.

                                                                                # (change requires restart)

 

 

​I'm out of ideas...

 

David J.​

Not to worry. This week I’m uninstalling and reinstalling postgres 9.6. I’ll do some tests and let this list know.

 

Mark Watson