Thread: FW: Serverlog 100GB
Greetings,
We're running PostGres on linux, version 8.1.x. on a new server for a few weeks. And the serverlog just consumed the rest of the disk space - 100GB log file. Wow, that's a personal record. I'm not a Linux guru so if you could point me in the right direction I'd appreciate it.
How do I go about changing the "serverlog" file settings? The only reference I've found to serverlog is: su -c 'pg_ctl start -D /usr/local/pgsql/data -l serverlog' postgres.
Thanks,
Randy
"Randy How" <rhow@i3.com> writes: > We're running PostGres on linux, version 8.1.x. on a new server for a few > weeks. And the serverlog just consumed the rest of the disk space - 100GB > log file. Wow, that's a personal record. Perhaps choose less verbose logging settings? But really the correct answer to this is to set up a logfile rotation schedule, which you can easily do with either syslog or redirect_stderr log methods. I'd lean to the latter myself. regards, tom lane
Thanks Tom, http://www.postgresql.org/docs/8.1/interactive/logfile-maintenance.html I'll go over this documentation. Thanks again Randy -----Original Message----- From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Tom Lane Sent: Thursday, August 24, 2006 10:37 PM To: Randy How Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] FW: Serverlog 100GB "Randy How" <rhow@i3.com> writes: > We're running PostGres on linux, version 8.1.x. on a new server for a > few weeks. And the serverlog just consumed the rest of the disk space > - 100GB log file. Wow, that's a personal record. Perhaps choose less verbose logging settings? But really the correct answer to this is to set up a logfile rotation schedule, which you can easily do with either syslog or redirect_stderr log methods. I'd lean to the latter myself. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings
Steve, Our confusion about this is how the "serverlog" is getting populated in the first place. Where does this filename get set? How can it be changed? Looking through postgresql.conf, there is no mention of "serverlog." The logging section seems to have everything set to defaults, including verbosity. The #redirect_stderr variable is set to "off", which, according to my understanding, means that there is supposed to be no logging in the first place. What are we missing here? Here is a copy of the log section of postgresql.conf: #--------------------------------------------------------------------------- # ERROR REPORTING AND LOGGING #--------------------------------------------------------------------------- # - Where to Log - #log_destination = 'stderr' # Valid values are combinations of # stderr, syslog and eventlog, # depending on platform. # This is used when logging to stderr: #redirect_stderr = off # Enable capturing of stderr into log # files # These are only used if redirect_stderr is on: #log_directory = 'pg_log' # Directory where log files are written # Can be absolute or relative to PGDATA #log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # Log file name pattern. # Can include strftime() escapes #log_truncate_on_rotation = off # If on, any existing log file of the same # name as the new log file will be # truncated rather than appended to. But # such truncation only occurs on # time-driven rotation, not on restarts # or size-driven rotation. Default is # off, meaning append to existing files # in all cases. #log_rotation_age = 1440 # Automatic rotation of logfiles will # happen after so many minutes. 0 to # disable. #log_rotation_size = 10240 # Automatic rotation of logfiles will # happen after so many kilobytes of log # output. 0 to disable. # These are relevant when logging to syslog: #syslog_facility = 'LOCAL0' #syslog_ident = 'postgres' # - When to Log - #client_min_messages = notice # Values, in order of decreasing detail: # debug5 # debug4 # debug3 # debug2 # debug1 # log # notice # warning # error #log_min_messages = notice # Values, in order of decreasing detail: # debug5 # debug4 # debug3 # debug2 # debug1 # info # notice # warning # error # log # fatal # panic #log_error_verbosity = default # terse, default, or verbose messages #log_min_error_statement = panic # Values in order of increasing severity : # debug5 # debug4 # debug3 # debug2 # debug1 # info # notice # warning # error # panic(off) #log_min_duration_statement = -1 # -1 is disabled, 0 logs all statements # and their durations, in milliseconds. #silent_mode = off # DO NOT USE without syslog or # redirect_stderr # - What to Log - #debug_print_parse = off #debug_print_rewritten = off #debug_print_plan = off #debug_pretty_print = off #log_connections = off #log_disconnections = off #log_duration = off #log_line_prefix = '' # Special values: # %u = user name # %d = database name # %r = remote host and port # %h = remote host # %p = PID # %t = timestamp (no milliseconds) # %m = timestamp with milliseconds # %i = command tag # %c = session id # %l = session line number # %s = session start timestamp # %x = transaction id # %q = stop here in non-session # processes # %% = '%' # e.g. '<%u%%%d> ' #log_statement = 'none' # none, mod, ddl, all #log_hostname = off -----Original Message----- From: Randy How [mailto:rhow@i3.com] Sent: Friday, August 25, 2006 8:52 AM To: 'Tom Lane' Cc: 'pgsql-general@postgresql.org' Subject: RE: [GENERAL] FW: Serverlog 100GB Thanks Tom, http://www.postgresql.org/docs/8.1/interactive/logfile-maintenance.html I'll go over this documentation. Thanks again Randy -----Original Message----- From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Tom Lane Sent: Thursday, August 24, 2006 10:37 PM To: Randy How Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] FW: Serverlog 100GB "Randy How" <rhow@i3.com> writes: > We're running PostGres on linux, version 8.1.x. on a new server for a > few weeks. And the serverlog just consumed the rest of the disk space > - 100GB log file. Wow, that's a personal record. Perhaps choose less verbose logging settings? But really the correct answer to this is to set up a logfile rotation schedule, which you can easily do with either syslog or redirect_stderr log methods. I'd lean to the latter myself. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings
On Friday 25 August 2006 10:34 am, Randy How wrote: > Steve, > > Our confusion about this is how the "serverlog" is getting populated in the > first place. Where does this filename get set? How can it be changed? > Looking through postgresql.conf, there is no mention of "serverlog." The > logging section seems to have everything set to defaults, including > verbosity. The #redirect_stderr variable is set to "off", which, according > to my understanding, means that there is supposed to be no logging in the > first place. What are we missing here? Here is a copy of the log section > of postgresql.conf: > > #-------------------------------------------------------------------------- >- # ERROR REPORTING AND LOGGING > #-------------------------------------------------------------------------- >- > > # - Where to Log - > > #log_destination = 'stderr' # Valid values are combinations of > # stderr, syslog and eventlog, > # depending on platform. > > # This is used when logging to stderr: > #redirect_stderr = off # Enable capturing of stderr into > log > # files > > # These are only used if redirect_stderr is on: > #log_directory = 'pg_log' # Directory where log files are > written > # Can be absolute or relative to > PGDATA > #log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # Log file name pattern. > # Can include strftime() escapes > #log_truncate_on_rotation = off # If on, any existing log file of the same > # name as the new log file will be > # truncated rather than appended > to. But > # such truncation only occurs on > # time-driven rotation, not on > restarts > # or size-driven rotation. Default > is > # off, meaning append to existing > files > # in all cases. > #log_rotation_age = 1440 # Automatic rotation of logfiles > will > # happen after so many minutes. 0 > to > # disable. > #log_rotation_size = 10240 # Automatic rotation of logfiles > will > # happen after so many kilobytes of > log > # output. 0 to disable. > > # These are relevant when logging to syslog: > #syslog_facility = 'LOCAL0' > #syslog_ident = 'postgres' > > > # - When to Log - > > #client_min_messages = notice # Values, in order of decreasing > detail: > # debug5 > # debug4 > # debug3 > # debug2 > # debug1 > # log > # notice > # warning > # error > > #log_min_messages = notice # Values, in order of decreasing > detail: > # debug5 > # debug4 > # debug3 > # debug2 > # debug1 > # info > # notice > # warning > # error > # log > # fatal > # panic > > #log_error_verbosity = default # terse, default, or verbose > messages > > #log_min_error_statement = panic # Values in order of increasing > severity > > # debug5 > # debug4 > # debug3 > # debug2 > # debug1 > # info > # notice > # warning > # error > # panic(off) > > #log_min_duration_statement = -1 # -1 is disabled, 0 logs all > statements > # and their durations, in > milliseconds. > > #silent_mode = off # DO NOT USE without syslog or > # redirect_stderr > > # - What to Log - > > #debug_print_parse = off > #debug_print_rewritten = off > #debug_print_plan = off > #debug_pretty_print = off > #log_connections = off > #log_disconnections = off > #log_duration = off > #log_line_prefix = '' # Special values: > # %u = user name > # %d = database name > # %r = remote host and port > # %h = remote host > # %p = PID > # %t = timestamp (no > milliseconds) # %m = timestamp with milliseconds # %i = command tag > # %c = session id > # %l = session line number > # %s = session start timestamp > # %x = transaction id > # %q = stop here in non-session > # processes > # %% = '%' > # e.g. '<%u%%%d> ' > #log_statement = 'none' # none, mod, ddl, all > #log_hostname = off > > > -----Original Message----- > From: Randy How [mailto:rhow@i3.com] > Sent: Friday, August 25, 2006 8:52 AM > To: 'Tom Lane' > Cc: 'pgsql-general@postgresql.org' > Subject: RE: [GENERAL] FW: Serverlog 100GB > > Thanks Tom, > > http://www.postgresql.org/docs/8.1/interactive/logfile-maintenance.html > > I'll go over this documentation. > > Thanks again > Randy > > > -----Original Message----- > From: pgsql-general-owner@postgresql.org > [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Tom Lane > Sent: Thursday, August 24, 2006 10:37 PM > To: Randy How > Cc: pgsql-general@postgresql.org > Subject: Re: [GENERAL] FW: Serverlog 100GB > > "Randy How" <rhow@i3.com> writes: > > We're running PostGres on linux, version 8.1.x. on a new server for a > > few weeks. And the serverlog just consumed the rest of the disk space > > - 100GB log file. Wow, that's a personal record. > > Perhaps choose less verbose logging settings? But really the correct > answer to this is to set up a logfile rotation schedule, which you can > easily do with either syslog or redirect_stderr log methods. I'd lean to > the latter myself. > > regards, tom lane > > ---------------------------(end of broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings > > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly In your original post you referenced the following command- su -c 'pg_ctl start -D /usr/local/pgsql/data -l serverlog' postgres. This is where 'serverlog' is being created. In this mode the server just keeps on appending to 'serverlog'. See the following link for a more detailed explanation. http://www.postgresql.org/docs/8.1/interactive/app-pg-ctl.html One option is to remove the -l serverlog part of the pg_ctl command and then modify the postgres.conf settings mentioned above to get the logging you want. -- Adrian Klaver aklaver@comcast.net