current postgresql logfile being written to?
Hi there,
I was hoping for a method (like archive_command) to handle logfile processing/archiving/compression, but unless doing it the logrotate way, I don’t see anything that postgresql provides. Is that correct?
The closest I could find is: pg_rotate_logfile()… but here my question is where do I find the current active logfile(s) that postgresql is currently writing to?
(At least that way I can handle all the files that that postgresql is not writing to :) )
Hendrik
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
2017-06-22 13:54 GMT+12:00 hvjunk <hvjunk@gmail.com>:
Hi there,
I was hoping for a method (like archive_command) to handle logfile
processing/archiving/compression, but unless doing it the logrotate way,
I don’t see anything that postgresql provides. Is that correct?The closest I could find is: pg_rotate_logfile()… but here my question is
where do I find the current active logfile(s) that postgresql is currently
writing to?
(At least that way I can handle all the files that that postgresql is not
writing to :) )Hendrik
I use logging_collector + log_rotation_age + log_filename +
log_min_duration_statement
[1]: https://www.postgresql.org/docs/9.6/static/runtime-config-logging.html
Using those options PG automatically rotates and keep them for a week or
more if you specified it.
[1]: https://www.postgresql.org/docs/9.6/static/runtime-config-logging.html
On 22 Jun 2017, at 4:06 AM, Lucas Possamai <drum.lucas@gmail.com> wrote:
2017-06-22 13:54 GMT+12:00 hvjunk <hvjunk@gmail.com <mailto:hvjunk@gmail.com>>:
Hi there,I was hoping for a method (like archive_command) to handle logfile processing/archiving/compression, but unless doing it the logrotate way, I don’t see anything that postgresql provides. Is that correct?
The closest I could find is: pg_rotate_logfile()… but here my question is where do I find the current active logfile(s) that postgresql is currently writing to?
(At least that way I can handle all the files that that postgresql is not writing to :) )Hendrik
I use logging_collector + log_rotation_age + log_filename + log_min_duration_statement [1]
Using those options PG automatically rotates and keep them for a week or more if you specified it.
[1] https://www.postgresql.org/docs/9.6/static/runtime-config-logging.html <https://www.postgresql.org/docs/9.6/static/runtime-config-logging.html>
That I know, but which file is the postgresql server/cluster writing to right now?
2017-06-22 14:16 GMT+12:00 hvjunk <hvjunk@gmail.com>:
On 22 Jun 2017, at 4:06 AM, Lucas Possamai <drum.lucas@gmail.com> wrote:
2017-06-22 13:54 GMT+12:00 hvjunk <hvjunk@gmail.com>:
Hi there,
I was hoping for a method (like archive_command) to handle logfile
processing/archiving/compression, but unless doing it the logrotate way,
I don’t see anything that postgresql provides. Is that correct?The closest I could find is: pg_rotate_logfile()… but here my question is
where do I find the current active logfile(s) that postgresql is currently
writing to?
(At least that way I can handle all the files that that postgresql is not
writing to :) )Hendrik
I use logging_collector + log_rotation_age + log_filename + log_min_duration_statement
[1]Using those options PG automatically rotates and keep them for a week or
more if you specified it.[1] https://www.postgresql.org/docs/9.6/static/runtime-config-logging.html
That I know, but which file is the postgresql server/cluster writing to
right now?
On your postgresql.conf check log_directory. If it's the default, then:
/var/log/postgresql
Lucas
On 22 Jun 2017, at 04:44 , Lucas Possamai <drum.lucas@gmail.com> wrote:
2017-06-22 14:16 GMT+12:00 hvjunk <hvjunk@gmail.com <mailto:hvjunk@gmail.com>>:
On 22 Jun 2017, at 4:06 AM, Lucas Possamai <drum.lucas@gmail.com <mailto:drum.lucas@gmail.com>> wrote:
2017-06-22 13:54 GMT+12:00 hvjunk <hvjunk@gmail.com <mailto:hvjunk@gmail.com>>:
Hi there,I was hoping for a method (like archive_command) to handle logfile processing/archiving/compression, but unless doing it the logrotate way, I don’t see anything that postgresql provides. Is that correct?
The closest I could find is: pg_rotate_logfile()… but here my question is where do I find the current active logfile(s) that postgresql is currently writing to?
(At least that way I can handle all the files that that postgresql is not writing to :) )Hendrik
I use logging_collector + log_rotation_age + log_filename + log_min_duration_statement [1]
Using those options PG automatically rotates and keep them for a week or more if you specified it.
[1] https://www.postgresql.org/docs/9.6/static/runtime-config-logging.html <https://www.postgresql.org/docs/9.6/static/runtime-config-logging.html>
That I know, but which file is the postgresql server/cluster writing to right now?
On your postgresql.conf check log_directory. If it's the default, then: /var/log/postgresql
Okay Lucas, I’m looking at my log directory:
-rw------- 1 postgres postgres 1002231184 Jun 22 11:08 postgresql-2017-06-22_001050.log
-rw------- 1 postgres postgres 1073742619 Jun 22 11:08 postgresql-2017-06-22_001045.log
my log snippets:
# These are only used if logging_collector is on:
log_directory = '/var/log/postgresql/'
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
log_file_mode = 0600
log_truncate_on_rotation = off
log_rotation_age = 1h
log_rotation_size = 1GB
So which one is postgresql actually writing to right now? (no guessing, and the name might be a clue, but that is guessing IMHO)