Thread: Logging successful SELECTS?

Logging successful SELECTS?

From
Matthew Vernon
Date:
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


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: Logging successful SELECTS?

From
Виктор Егоров
Date:
2013/1/24 Matthew Vernon <matthew.vernon@sac.ac.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


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: Logging successful SELECTS?

From
Pavel Stehule
Date:
2013/1/24 Matthew Vernon <matthew.vernon@sac.ac.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@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: Logging successful SELECTS?

From
Виктор Егоров
Date:
2013/1/24 Matthew Vernon <matthew.vernon@sac.ac.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


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: Logging successful SELECTS?

From
Pavel Stehule
Date:
2013/1/24 Matthew Vernon <matthew.vernon@sac.ac.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@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general