Logging

Started by Rich Shepardover 6 years ago6 messagesgeneral
Jump to latest
#1Rich Shepard
rshepard@appl-ecosys.com

Running Slackware-14.2/x86_64 and postgresql-11.5.

In /var/log/ are these files:

-rw-r----- 1 postgres wheel 0 Nov 23 04:40 postgresql-11
-rw-r----- 1 postgres wheel 723 Nov 23 04:40 postgresql-11.1
-rw-r----- 1 postgres wheel 324 Nov 20 04:40 postgresql-11.2.gz
-rw-r----- 1 postgres wheel 320 Nov 17 04:40 postgresql-11.3.gz
-rw-r----- 1 postgres wheel 322 Nov 14 04:40 postgresql-11.4.gz
-rw-r----- 1 postgres wheel 321 Nov 10 04:40 postgresql-11.5.gz
-rw-r----- 1 postgres wheel 325 Nov 6 04:40 postgresql-11.6.gz
-rw-r----- 1 postgres wheel 337 Oct 23 04:40 postgresql-11.7.gz

I assume that they're an automatic backup that runs every 3-4 days. What's
backed up and where is this controlled?

I ask because I have a cron job that does a pg_dumpall each night at 11:30
pm. (It's a small installation for my business use so the files are not
excessive and I keep them for only short periods.)

Regards,

Rich

#2Stephen Eilert
contact@stepheneilert.com
In reply to: Rich Shepard (#1)
Re: Logging

Usually, this is done by logrotate or a similar mechanism in your system. You’ll likely find that other logs in your system follow a similar pattern, not just Postgresql.

— Stephen

Show quoted text

On Dec 4, 2019, 3:21 PM -0800, Rich Shepard <rshepard@appl-ecosys.com>, wrote:

Running Slackware-14.2/x86_64 and postgresql-11.5.

In /var/log/ are these files:

-rw-r----- 1 postgres wheel 0 Nov 23 04:40 postgresql-11
-rw-r----- 1 postgres wheel 723 Nov 23 04:40 postgresql-11.1
-rw-r----- 1 postgres wheel 324 Nov 20 04:40 postgresql-11.2.gz
-rw-r----- 1 postgres wheel 320 Nov 17 04:40 postgresql-11.3.gz
-rw-r----- 1 postgres wheel 322 Nov 14 04:40 postgresql-11.4.gz
-rw-r----- 1 postgres wheel 321 Nov 10 04:40 postgresql-11.5.gz
-rw-r----- 1 postgres wheel 325 Nov 6 04:40 postgresql-11.6.gz
-rw-r----- 1 postgres wheel 337 Oct 23 04:40 postgresql-11.7.gz

I assume that they're an automatic backup that runs every 3-4 days. What's
backed up and where is this controlled?

I ask because I have a cron job that does a pg_dumpall each night at 11:30
pm. (It's a small installation for my business use so the files are not
excessive and I keep them for only short periods.)

Regards,

Rich

#3Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Rich Shepard (#1)
Re: Logging

On 12/4/19 3:20 PM, Rich Shepard wrote:

Running Slackware-14.2/x86_64 and postgresql-11.5.

In /var/log/ are these files:

-rw-r----- 1 postgres wheel   0 Nov 23 04:40 postgresql-11
-rw-r----- 1 postgres wheel 723 Nov 23 04:40 postgresql-11.1
-rw-r----- 1 postgres wheel 324 Nov 20 04:40 postgresql-11.2.gz
-rw-r----- 1 postgres wheel 320 Nov 17 04:40 postgresql-11.3.gz
-rw-r----- 1 postgres wheel 322 Nov 14 04:40 postgresql-11.4.gz
-rw-r----- 1 postgres wheel 321 Nov 10 04:40 postgresql-11.5.gz
-rw-r----- 1 postgres wheel 325 Nov  6 04:40 postgresql-11.6.gz
-rw-r----- 1 postgres wheel 337 Oct 23 04:40 postgresql-11.7.gz

I assume that they're an automatic backup that runs every 3-4 days. What's
backed up and where is this controlled?

Looks like logrotate.
Take a look at the logging section of postgresql.conf to see if Postgres
is handing off to the system and logrotate

I ask because I have a cron job that does a pg_dumpall each night at 11:30
pm. (It's a small installation for my business use so the files are not
excessive and I keep them for only short periods.)

Regards,

Rich

--
Adrian Klaver
adrian.klaver@aklaver.com

#4Rich Shepard
rshepard@appl-ecosys.com
In reply to: Stephen Eilert (#2)
Re: Logging [RESOLVED]

On Wed, 4 Dec 2019, Stephen Eilert wrote:

Usually, this is done by logrotate or a similar mechanism in your system.
You’ll likely find that other logs in your system follow a similar
pattern, not just Postgresql.

Stephen,

Other logs, controlled by logrotate, rotate daily for a maximum of 4
backups.

I just checked /etc/logrotate.d/postgres and it was set at daily with rotate
7. I changed rotate to 4 but the dates are 3-4 days apart, not sequential.

Thanks,

Rich

#5Rich Shepard
rshepard@appl-ecosys.com
In reply to: Adrian Klaver (#3)
Re: Logging

On Wed, 4 Dec 2019, Adrian Klaver wrote:

Take a look at the logging section of postgresql.conf to see if Postgres is
handing off to the system and logrotate

Adrian,

That conf file is in several places (different flavors). I'll check them
all.

Thanks,

Rich

#6Peter J. Holzer
hjp-pgsql@hjp.at
In reply to: Rich Shepard (#4)
Re: Logging [RESOLVED]

On 2019-12-04 16:03:24 -0800, Rich Shepard wrote:

On Wed, 4 Dec 2019, Stephen Eilert wrote:

Usually, this is done by logrotate or a similar mechanism in your system.
You’ll likely find that other logs in your system follow a similar
pattern, not just Postgresql.

I just checked /etc/logrotate.d/postgres and it was set at daily with rotate
7. I changed rotate to 4 but the dates are 3-4 days apart, not sequential.

Your log files are extremely small. At only a few hundred bytes every 3
or 4 days it is very likely that nothing is logged on most days. If your
log file is empty, logrotate won't rotate it if the option "notifempty"
is set (which is probably the case).

hp

--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp@hjp.at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"