pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Logging
15+ messages / 10 participants
[nested] [flat]

* Logging
@ 2000-11-20 18:57  Anders R. Sveen <anderssv@stud.ntnu.no>
  0 siblings, 1 reply; 15+ messages in thread

From: Anders R. Sveen @ 2000-11-20 18:57 UTC (permalink / raw)
  To: pgsql-admin@postgresql.org

Hey,

I've set my pg_options file to write log messages, but it only logs to
/var/log/messages instead of /var/log/postgresql wich remains empty. 

Why is that and how can i change it? Maybe it's a sylog question, but
beeing new to it and all i can't really figure things out.

I've installed the 7.0.3-1 rpm on an RedHat 6.2 system.

Thanks,
Anders,




^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: Logging
@ 2000-11-20 19:57  Lamar Owen <lamar.owen@wgcr.org>
  parent: Anders R. Sveen <anderssv@stud.ntnu.no>
  0 siblings, 0 replies; 15+ messages in thread

From: Lamar Owen @ 2000-11-20 19:57 UTC (permalink / raw)
  To: Anders R. Sveen <anderssv@stud.ntnu.no>; +Cc: pgsql-admin@postgresql.org

"Anders R. Sveen" wrote:
> I've set my pg_options file to write log messages, but it only logs to
> /var/log/messages instead of /var/log/postgresql wich remains empty.
 
> Why is that and how can i change it? Maybe it's a sylog question, but
> beeing new to it and all i can't really figure things out.

You need to edit /etc/syslog.conf to direct the output of PostgreSQL to
the file you wish to hold the log.  The facility used by default in
7.0.3 is local0, so a line:
local0.*                /var/log/postgresql
will do what you expect.
--
Lamar Owen
WGCR Internet Radio
1 Peter 4:11



^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* logging
@ 2004-11-11 15:47  David Parker <dparker@tazznetworks.com>
  0 siblings, 1 reply; 15+ messages in thread

From: David Parker @ 2004-11-11 15:47 UTC (permalink / raw)
  To: pgsql-general

What is the relationship between the "-d" parameter to postmaster and the various "log_*" directives in the postgresql.conf? Specifically, does a certain -d level have to be specified before certain log_* directives take effect?

- DAP
----------------------------------------------------------------------------------
David Parker    Tazz Networks    (401) 709-5130
 



^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: logging
@ 2004-11-11 18:32  Bruce Momjian <pgman@candle.pha.pa.us>
  parent: David Parker <dparker@tazznetworks.com>
  0 siblings, 0 replies; 15+ messages in thread

From: Bruce Momjian @ 2004-11-11 18:32 UTC (permalink / raw)
  To: David Parker <dparker@tazznetworks.com>; +Cc: pgsql-general

David Parker wrote:
> What is the relationship between the "-d" parameter to postmaster and
> the various "log_*" directives in the postgresql.conf? Specifically,
> does a certain -d level have to be specified before certain log_*
> directives take effect?

The -d flag in postmaster and postgres control log_min_messages =
DEBUG_X where X = 1-5.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073



^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Logging
@ 2018-06-12 22:37  Andrew Bartley <ambartley@gmail.com>
  0 siblings, 1 reply; 15+ messages in thread

From: Andrew Bartley @ 2018-06-12 22:37 UTC (permalink / raw)
  To: pgsql-general

Hi all,

Can someone please tell me how to log the values being inserted in this
example..

2018-06-12 22:31:49 UTC-5b2049d4.434ac-STATEMENT:  insert into
"api_consumers" ("consumer_id", "create_datetime") values ($1, $2).

I have tried many different logging options and combinations.

Thanks

Andrew Bartley

^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: Logging
@ 2018-06-13 02:43  Laurenz Albe <laurenz.albe@cybertec.at>
  parent: Andrew Bartley <ambartley@gmail.com>
  0 siblings, 1 reply; 15+ messages in thread

From: Laurenz Albe @ 2018-06-13 02:43 UTC (permalink / raw)
  To: Andrew Bartley <ambartley@gmail.com>; pgsql-general

Andrew Bartley wrote:
> Can someone please tell me how to log the values being inserted in this example..
> 
> 2018-06-12 22:31:49 UTC-5b2049d4.434ac-STATEMENT:  insert into "api_consumers" ("consumer_id", "create_datetime") values ($1, $2).
> 
> I have tried many different logging options and combinations. 

That should automatically be logged as a DETAIL message.

log_min_duration_statement = 0
log_min_error_statement = log or better
log_min_messages = log or better

That should do the trick.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com




^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: Logging
@ 2018-06-13 03:03  Andrew Bartley <ambartley@gmail.com>
  parent: Laurenz Albe <laurenz.albe@cybertec.at>
  0 siblings, 1 reply; 15+ messages in thread

From: Andrew Bartley @ 2018-06-13 03:03 UTC (permalink / raw)
  To: pgsql-general

On Wed, 13 Jun 2018 at 12:43 Laurenz Albe <laurenz.albe@cybertec.at> wrote:

> Andrew Bartley wrote:
> > Can someone please tell me how to log the values being inserted in this
> example..
> >
> > 2018-06-12 22:31:49 UTC-5b2049d4.434ac-STATEMENT:  insert into
> "api_consumers" ("consumer_id", "create_datetime") values ($1, $2).
> >
> > I have tried many different logging options and combinations.
>
> That should automatically be logged as a DETAIL message.
>
> log_min_duration_statement = 0
> log_min_error_statement = log or better
> log_min_messages = log or better
>
> That should do the trick.
>
> Yours,
> Laurenz Albe
> --
> Cybertec | https://www.cybertec-postgresql.com

Thanks for the reply Laurenz,


Current settings

"PostgreSQL 9.6.7, compiled by Visual C++ build 1800, 64-bit"
Azure managed instance


log_min_duration_statement -1
log_min_error_statement DEBUG2
log_min_messages DEBUG2
log_statement ALL
log_error_verbosity VERBOSE

Still no joy.

Thanks Andrew

^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: Logging
@ 2018-06-13 03:25  David G. Johnston <david.g.johnston@gmail.com>
  parent: Andrew Bartley <ambartley@gmail.com>
  0 siblings, 2 replies; 15+ messages in thread

From: David G. Johnston @ 2018-06-13 03:25 UTC (permalink / raw)
  To: Andrew Bartley <ambartley@gmail.com>; +Cc: pgsql-general

On Tuesday, June 12, 2018, Andrew Bartley <ambartley@gmail.com> wrote:

>
>
> On Wed, 13 Jun 2018 at 12:43 Laurenz Albe <laurenz.albe@cybertec.at>
> wrote:
>
>>
>> log_min_duration_statement = 0
>>
> [...]

>
> log_min_duration_statement -1
>

You've disabled statement logging altogether.  The zero value you were
directed to use is what causes everything to be logged.

David J.

^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: Logging
@ 2018-06-13 03:28  Andrew Bartley <ambartley@gmail.com>
  parent: David G. Johnston <david.g.johnston@gmail.com>
  1 sibling, 0 replies; 15+ messages in thread

From: Andrew Bartley @ 2018-06-13 03:28 UTC (permalink / raw)
  To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: pgsql-general

Ok, thanks.   will try

On Wed, 13 Jun 2018 at 13:25 David G. Johnston <david.g.johnston@gmail.com>
wrote:

> On Tuesday, June 12, 2018, Andrew Bartley <ambartley@gmail.com> wrote:
>
>> On Wed, 13 Jun 2018 at 12:43 Laurenz Albe <laurenz.albe@cybertec.at>
>> wrote:
>>
>
>>> log_min_duration_statement = 0
>>>
>> [...]
>
>>
>> log_min_duration_statement -1
>>
>
> You've disabled statement logging altogether.  The zero value you were
> directed to use is what causes everything to be logged.
>
> David J.
>
>
>

^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: Logging
@ 2018-06-13 04:12  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: David G. Johnston <david.g.johnston@gmail.com>
  1 sibling, 1 reply; 15+ messages in thread

From: Adrian Klaver @ 2018-06-13 04:12 UTC (permalink / raw)
  To: David G. Johnston <david.g.johnston@gmail.com>; Andrew Bartley <ambartley@gmail.com>; +Cc: pgsql-general

On 06/12/2018 08:25 PM, David G. Johnston wrote:
> On Tuesday, June 12, 2018, Andrew Bartley <ambartley@gmail.com 
> <mailto:ambartley@gmail.com>> wrote:
> 
> 
> 
>     On Wed, 13 Jun 2018 at 12:43 Laurenz Albe <laurenz.albe@cybertec.at
>     <mailto:laurenz.albe@cybertec.at>> wrote:
> 
> 
>         log_min_duration_statement = 0
> 
> [...]
> 
> 
>     log_min_duration_statement -1
> 
> 
> You've disabled statement logging altogether.  The zero value you were 
> directed to use is what causes everything to be logged.

Actually no:

https://www.postgresql.org/docs/10/static/runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-WHEN

log_min_duration_statement (integer)

"... Setting this to zero prints all statement durations. Minus-one (the 
default) disables logging statement durations.  ..."

"

So -1 only affects logging statements relative to duration.

If you have log_statements set then you will still get statements logged 
if you have log_min_duration_statement = -1 :

Note

When using this option together with log_statement, the text of 
statements that are logged because of log_statement will not be repeated 
in the duration log message.
"

This is how I have my logging setup, log_min_duration_statement = -1
and log_statements = 'mod' and I see statements in the logs.

> 
> David J.
> 
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com




^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: Logging
@ 2018-06-13 04:21  Andrew Bartley <ambartley@gmail.com>
  parent: Adrian Klaver <adrian.klaver@aklaver.com>
  0 siblings, 0 replies; 15+ messages in thread

From: Andrew Bartley @ 2018-06-13 04:21 UTC (permalink / raw)
  To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: David G. Johnston <david.g.johnston@gmail.com>; pgsql-general

Thanks All,

It seems that the related DETAIL message appears if the query is
successful.  On error the DETAIL log line is missing...   This makes
debugging difficult, considering the insert is coming from Dreamfactory via
a rest POST.

I am finding it very difficult navigating my way through the brave new
world of SAS and Blackbox type applications....  Maybe 32 years as a
database programmer is just too long.

Thanks

Andrew




On Wed, 13 Jun 2018 at 14:12 Adrian Klaver <adrian.klaver@aklaver.com>
wrote:

> On 06/12/2018 08:25 PM, David G. Johnston wrote:
> > On Tuesday, June 12, 2018, Andrew Bartley <ambartley@gmail.com
> > <mailto:ambartley@gmail.com>> wrote:
> >
> >
> >
> >     On Wed, 13 Jun 2018 at 12:43 Laurenz Albe <laurenz.albe@cybertec.at
> >     <mailto:laurenz.albe@cybertec.at>> wrote:
> >
> >
> >         log_min_duration_statement = 0
> >
> > [...]
> >
> >
> >     log_min_duration_statement -1
> >
> >
> > You've disabled statement logging altogether.  The zero value you were
> > directed to use is what causes everything to be logged.
>
> Actually no:
>
>
> https://www.postgresql.org/docs/10/static/runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-WHEN
>
> log_min_duration_statement (integer)
>
> "... Setting this to zero prints all statement durations. Minus-one (the
> default) disables logging statement durations.  ..."
>
> "
>
> So -1 only affects logging statements relative to duration.
>
> If you have log_statements set then you will still get statements logged
> if you have log_min_duration_statement = -1 :
>
> Note
>
> When using this option together with log_statement, the text of
> statements that are logged because of log_statement will not be repeated
> in the duration log message.
> "
>
> This is how I have my logging setup, log_min_duration_statement = -1
> and log_statements = 'mod' and I see statements in the logs.
>
> >
> > David J.
> >
> >
>
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com
>

^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Logging
@ 2019-12-04 23:20  Rich Shepard <rshepard@appl-ecosys.com>
  0 siblings, 2 replies; 15+ messages in thread

From: Rich Shepard @ 2019-12-04 23:20 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

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





^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: Logging
@ 2019-12-04 23:24  Stephen Eilert <contact@stepheneilert.com>
  parent: Rich Shepard <rshepard@appl-ecosys.com>
  1 sibling, 0 replies; 15+ messages in thread

From: Stephen Eilert @ 2019-12-04 23:24 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org; Rich Shepard <rshepard@appl-ecosys.com>

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
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
>
>

^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: Logging
@ 2019-12-04 23:26  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: Rich Shepard <rshepard@appl-ecosys.com>
  1 sibling, 1 reply; 15+ messages in thread

From: Adrian Klaver @ 2019-12-04 23:26 UTC (permalink / raw)
  To: Rich Shepard <rshepard@appl-ecosys.com>; pgsql-general@lists.postgresql.org

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





^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: Logging
@ 2019-12-05 00:06  Rich Shepard <rshepard@appl-ecosys.com>
  parent: Adrian Klaver <adrian.klaver@aklaver.com>
  0 siblings, 0 replies; 15+ messages in thread

From: Rich Shepard @ 2019-12-05 00:06 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

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





^ permalink  raw  reply  [nested|flat] 15+ messages in thread


end of thread, other threads:[~2019-12-05 00:06 UTC | newest]

Thread overview: 15+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-11-20 18:57 Logging Anders R. Sveen <anderssv@stud.ntnu.no>
2000-11-20 19:57 ` Lamar Owen <lamar.owen@wgcr.org>
2004-11-11 15:47 logging David Parker <dparker@tazznetworks.com>
2004-11-11 18:32 ` Re: logging Bruce Momjian <pgman@candle.pha.pa.us>
2018-06-12 22:37 Logging Andrew Bartley <ambartley@gmail.com>
2018-06-13 02:43 ` Laurenz Albe <laurenz.albe@cybertec.at>
2018-06-13 03:03   ` Andrew Bartley <ambartley@gmail.com>
2018-06-13 03:25     ` David G. Johnston <david.g.johnston@gmail.com>
2018-06-13 03:28       ` Andrew Bartley <ambartley@gmail.com>
2018-06-13 04:12       ` Adrian Klaver <adrian.klaver@aklaver.com>
2018-06-13 04:21         ` Andrew Bartley <ambartley@gmail.com>
2019-12-04 23:20 Logging Rich Shepard <rshepard@appl-ecosys.com>
2019-12-04 23:24 ` Stephen Eilert <contact@stepheneilert.com>
2019-12-04 23:26 ` Adrian Klaver <adrian.klaver@aklaver.com>
2019-12-05 00:06   ` Rich Shepard <rshepard@appl-ecosys.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox