How to erase transaction logs on PostgreSQL

Started by Frank Churchabout 14 years ago7 messagesgeneral
Jump to latest
#1Frank Church
voipfc@gmail.com

How do you purge the postgresql transaction log?

I am creating a virtual machine image and I want to erase any transaction
logs that got built up during development. What is the way to do that?

I am currently using 8.3 and 8.4.

Is there the possibility that the logs saved in /var/log also contain
security details?

/voipfc

#2Achilleas Mantzios
achill@smadev.internal.net
In reply to: Frank Church (#1)
Re: How to erase transaction logs on PostgreSQL

one ultra dummy way would be to dump, back up, destroy the data dirs,
and any human /var/log files and then re-initdb and restore.

On Πεμ 08 Μαρ 2012 12:18:17 Frank Church wrote:

How do you purge the postgresql transaction log?

I am creating a virtual machine image and I want to erase any transaction
logs that got built up during development. What is the way to do that?

I am currently using 8.3 and 8.4.

Is there the possibility that the logs saved in /var/log also contain
security details?

/voipfc

--
Achilleas Mantzios
IT DEPT

#3Guillaume Lelarge
guillaume@lelarge.info
In reply to: Frank Church (#1)
Re: How to erase transaction logs on PostgreSQL

On Thu, 2012-03-08 at 10:18 +0000, Frank Church wrote:

How do you purge the postgresql transaction log?

You don't. PostgreSQL does it for you.

I am creating a virtual machine image and I want to erase any transaction
logs that got built up during development. What is the way to do that?

I am currently using 8.3 and 8.4.

Is there the possibility that the logs saved in /var/log also contain
security details?

The only security detail AFAIK would be passwords (if you set a password
and log queries, the password will be in the logs... the only way to
prevent that is to send it crypted).

--
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com

#4Frank Church
voipfc@gmail.com
In reply to: Guillaume Lelarge (#3)
Re: How to erase transaction logs on PostgreSQL

On 8 March 2012 16:23, Guillaume Lelarge <guillaume@lelarge.info> wrote:

On Thu, 2012-03-08 at 10:18 +0000, Frank Church wrote:

How do you purge the postgresql transaction log?

You don't. PostgreSQL does it for you.

I am creating a virtual machine image and I want to erase any transaction
logs that got built up during development. What is the way to do that?

I am currently using 8.3 and 8.4.

Is there the possibility that the logs saved in /var/log also contain
security details?

The only security detail AFAIK would be passwords (if you set a password
and log queries, the password will be in the logs... the only way to
prevent that is to send it crypted).

What are the commands to accomplish that, ie getting PostgreSQL to erase
the logs?

Show quoted text

--
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com

#5Guillaume Lelarge
guillaume@lelarge.info
In reply to: Frank Church (#4)
Re: How to erase transaction logs on PostgreSQL

On Fri, 2012-03-09 at 00:09 +0000, Frank Church wrote:

On 8 March 2012 16:23, Guillaume Lelarge <guillaume@lelarge.info>
wrote:
On Thu, 2012-03-08 at 10:18 +0000, Frank Church wrote:

How do you purge the postgresql transaction log?

You don't. PostgreSQL does it for you.

I am creating a virtual machine image and I want to erase

any transaction

logs that got built up during development. What is the way

to do that?

I am currently using 8.3 and 8.4.

Is there the possibility that the logs saved in /var/log

also contain

security details?

The only security detail AFAIK would be passwords (if you set
a password
and log queries, the password will be in the logs... the only
way to
prevent that is to send it crypted).

What are the commands to accomplish that, ie getting PostgreSQL to
erase the logs?

PostgreSQL doesn't erase logs. You need to do it yourself, either
manually or with a script (executed by cron for example).

--
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com

#6Simon Riggs
simon@2ndQuadrant.com
In reply to: Frank Church (#1)
Re: How to erase transaction logs on PostgreSQL

On Thu, Mar 8, 2012 at 10:18 AM, Frank Church <voipfc@gmail.com> wrote:

How do you purge the postgresql transaction log?

I am creating a virtual machine image and I want to erase any transaction
logs that got built up during development. What is the way to do that?

pg_resetxlog

I am currently using 8.3 and 8.4.

Is there the possibility that the logs saved in /var/log also contain
security details?

I suggest you delete them.

--
 Simon Riggs                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

#7John R Pierce
pierce@hogranch.com
In reply to: Frank Church (#4)
Re: How to erase transaction logs on PostgreSQL

On 03/08/12 4:09 PM, Frank Church wrote:

What are the commands to accomplish that, ie getting PostgreSQL to
erase the logs?

there's two completely different sorts of logs here. 'transaction
logs' in postgres are the write-ahead logs, these are binary files used
internally by postgres, in the pg_xlog directory, as Simon said, you can
use pg_resetxlog() to 'reset' the state of this.

the other sort of logs are the human readable log files, generated for
debugging and auditing purposes, these contain just what you configure
them to contain, and are often stored in pg_log, or in the system logs
(/var/log/...) depending on your configuration. you'd have to delete
these yourself outside of postgres.

--
john r pierce N 37, W 122
santa cruz ca mid-left coast