Re: Logging successful SELECTS?

Lists: pgsql-general
From: Matthew Vernon <matthew(dot)vernon(at)sac(dot)ac(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: Logging successful SELECTS?
Date: 2013-01-24 12:21:42
Message-ID: 87boceg4b4.fsf@macbeth.sac.ac.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Hi,

I can get postgres to log unsuccessful queries, including the user who
wrote them, but I'm missing how to get postgres to log the successful
queries too (I don't need a store of the answer, just the query
itself). How do I do this?

Thanks,

Matthew

--
Matthew Vernon
Quantitative Veterinary Epidemiologist
Epidemiology Research Unit, SAC Inverness


From: Виктор Егоров <vyegorov(at)gmail(dot)com>
To: Matthew Vernon <matthew(dot)vernon(at)sac(dot)ac(dot)uk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Logging successful SELECTS?
Date: 2013-01-24 12:48:26
Message-ID: CAGnEbogMzfkpdCDRJXr1nT1OdM8z9FgDjSTa_qTC1x-yoSsfDA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

2013/1/24 Matthew Vernon <matthew(dot)vernon(at)sac(dot)ac(dot)uk>:
> I can get postgres to log unsuccessful queries, including the user who
> wrote them, but I'm missing how to get postgres to log the successful
> queries too (I don't need a store of the answer, just the query
> itself). How do I do this?

You can use either log_min_duration_statement or log_statement.
http://www.postgresql.org/docs/current/interactive/runtime-config-logging.html

I would recommend using the first one, logging all statements that took longer
then, say, 300ms. Otherwise logs might become too huge to manage.

--
Victor Y. Yegorov


From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Matthew Vernon <matthew(dot)vernon(at)sac(dot)ac(dot)uk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Logging successful SELECTS?
Date: 2013-01-24 12:57:16
Message-ID: CAFj8pRDHJGfbocY4B4Od49fEOyiaRPRc_Uyj5GKx4VqC8PjfFQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

2013/1/24 Matthew Vernon <matthew(dot)vernon(at)sac(dot)ac(dot)uk>:
> Hi,
>
> I can get postgres to log unsuccessful queries, including the user who
> wrote them, but I'm missing how to get postgres to log the successful
> queries too (I don't need a store of the answer, just the query
> itself). How do I do this?

use log_min_duration_statement = 0

Regards

Pavel Stehule

>
> Thanks,
>
> Matthew
>
> --
> Matthew Vernon
> Quantitative Veterinary Epidemiologist
> Epidemiology Research Unit, SAC Inverness
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general