pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Advice on logging strategy
6+ messages / 4 participants
[nested] [flat]

* Advice on logging strategy
@ 2018-10-11 10:26 Mike Martin <redtux1@gmail.com>
  2018-10-11 10:33 ` Re: Advice on logging strategy Rob Sargent <robjsargent@gmail.com>
  2018-10-11 15:36 ` Re: Advice on logging strategy Jeff Janes <jeff.janes@gmail.com>
  2018-10-12 13:33 ` Re: Advice on logging strategy David Steele <david@pgmasters.net>
  0 siblings, 3 replies; 6+ messages in thread

From: Mike Martin @ 2018-10-11 10:26 UTC (permalink / raw)
  To: pgsql-general

I have a question on logging strategy

I have loggin set to
log_statement = 'all' on a network database with logging set to csv so I
can import it to a logging table

However the database is populated via a nightly routine downloading data
via REST APIusing prepared statements

This results in enormous log files which take ages to import using copy
becuase each execute statement is logged with the parameters chosen

Is there any way around this?

I cant find any way to filter dml statements

thanks

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

* Re: Advice on logging strategy
  2018-10-11 10:26 Advice on logging strategy Mike Martin <redtux1@gmail.com>
@ 2018-10-11 10:33 ` Rob Sargent <robjsargent@gmail.com>
  2018-10-11 11:06   ` Re: Advice on logging strategy Mike Martin <redtux1@gmail.com>
  2 siblings, 1 reply; 6+ messages in thread

From: Rob Sargent @ 2018-10-11 10:33 UTC (permalink / raw)
  To: Mike Martin <redtux1@gmail.com>; +Cc: pgsql-general



> On Oct 11, 2018, at 4:26 AM, Mike Martin <redtux1@gmail.com> wrote:
> 
> I have a question on logging strategy
> 
> I have loggin set to
> log_statement = 'all' on a network database with logging set to csv so I can import it to a logging table
> 
> However the database is populated via a nightly routine downloading data via REST APIusing prepared statements
> 
> This results in enormous log files which take ages to import using copy becuase each execute statement is logged with the parameters chosen
> 
> Is there any way around this?
> 
> I cant find any way to filter dml statements
> 
> thanks	
> 
Do you want all the log lines in you logging table?
There was a thread yesterday (10.Oct.2018) on COPY which mention the possibility of multiple processes COPYing to same table.



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

* Re: Advice on logging strategy
  2018-10-11 10:26 Advice on logging strategy Mike Martin <redtux1@gmail.com>
  2018-10-11 10:33 ` Re: Advice on logging strategy Rob Sargent <robjsargent@gmail.com>
@ 2018-10-11 11:06   ` Mike Martin <redtux1@gmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Mike Martin @ 2018-10-11 11:06 UTC (permalink / raw)
  To: robjsargent@gmail.com; +Cc: pgsql-general

I suppose the ideal would be to log the prepared statement once and detail
only if error rather than one per execution

On Thu, 11 Oct 2018 at 11:33, Rob Sargent <robjsargent@gmail.com> wrote:

>
>
> > On Oct 11, 2018, at 4:26 AM, Mike Martin <redtux1@gmail.com> wrote:
> >
> > I have a question on logging strategy
> >
> > I have loggin set to
> > log_statement = 'all' on a network database with logging set to csv so I
> can import it to a logging table
> >
> > However the database is populated via a nightly routine downloading data
> via REST APIusing prepared statements
> >
> > This results in enormous log files which take ages to import using copy
> becuase each execute statement is logged with the parameters chosen
> >
> > Is there any way around this?
> >
> > I cant find any way to filter dml statements
> >
> > thanks
> >
> Do you want all the log lines in you logging table?
> There was a thread yesterday (10.Oct.2018) on COPY which mention the
> possibility of multiple processes COPYing to same table.

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

* Re: Advice on logging strategy
  2018-10-11 10:26 Advice on logging strategy Mike Martin <redtux1@gmail.com>
@ 2018-10-11 15:36 ` Jeff Janes <jeff.janes@gmail.com>
  2 siblings, 0 replies; 6+ messages in thread

From: Jeff Janes @ 2018-10-11 15:36 UTC (permalink / raw)
  To: redtux1@gmail.com; +Cc: pgsql-general

On Thu, Oct 11, 2018 at 6:27 AM Mike Martin <redtux1@gmail.com> wrote:

> I have a question on logging strategy
>
> I have loggin set to
> log_statement = 'all' on a network database with logging set to csv so I
> can import it to a logging table
>
> However the database is populated via a nightly routine downloading data
> via REST APIusing prepared statements
>
> This results in enormous log files which take ages to import using copy
> becuase each execute statement is logged with the parameters chosen
>
> Is there any way around this?
>

One option is to convert to using COPY...FROM STDIN rather than prepared
INSERTs.

Another is to create a user specifically for bulk population, and do a
'ALTER USER bulk_load SET log_statement=none` to override the global
log_statement setting.

Cheers,

Jeff

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

* Re: Advice on logging strategy
  2018-10-11 10:26 Advice on logging strategy Mike Martin <redtux1@gmail.com>
@ 2018-10-12 13:33 ` David Steele <david@pgmasters.net>
  2018-10-12 14:17   ` Re: Advice on logging strategy Mike Martin <redtux1@gmail.com>
  2 siblings, 1 reply; 6+ messages in thread

From: David Steele @ 2018-10-12 13:33 UTC (permalink / raw)
  To: Mike Martin <redtux1@gmail.com>; pgsql-general

On 10/11/18 11:26 AM, Mike Martin wrote:
> 
> This results in enormous log files which take ages to import using copy 
> becuase each execute statement is logged with the parameters chosen
> 
> Is there any way around this?
> 
> I cant find any way to filter dml statements

pgAudit (https://github.com/pgaudit/pgaudit) gives you fine-grain 
control over what is logged by command type, table, or user as well as a 
lot more detail.

-- 
-David
david@pgmasters.net




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

* Re: Advice on logging strategy
  2018-10-11 10:26 Advice on logging strategy Mike Martin <redtux1@gmail.com>
  2018-10-12 13:33 ` Re: Advice on logging strategy David Steele <david@pgmasters.net>
@ 2018-10-12 14:17   ` Mike Martin <redtux1@gmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Mike Martin @ 2018-10-12 14:17 UTC (permalink / raw)
  To: david@pgmasters.net; +Cc: pgsql-general

Thanks!

On Fri, 12 Oct 2018 at 14:33, David Steele <david@pgmasters.net> wrote:

> On 10/11/18 11:26 AM, Mike Martin wrote:
> >
> > This results in enormous log files which take ages to import using copy
> > becuase each execute statement is logged with the parameters chosen
> >
> > Is there any way around this?
> >
> > I cant find any way to filter dml statements
>
> pgAudit (https://github.com/pgaudit/pgaudit) gives you fine-grain
> control over what is logged by command type, table, or user as well as a
> lot more detail.
>
> --
> -David
> david@pgmasters.net
>

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


end of thread, other threads:[~2018-10-12 14:17 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-10-11 10:26 Advice on logging strategy Mike Martin <redtux1@gmail.com>
2018-10-11 10:33 ` Rob Sargent <robjsargent@gmail.com>
2018-10-11 11:06   ` Mike Martin <redtux1@gmail.com>
2018-10-11 15:36 ` Jeff Janes <jeff.janes@gmail.com>
2018-10-12 13:33 ` David Steele <david@pgmasters.net>
2018-10-12 14:17   ` Mike Martin <redtux1@gmail.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