aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/misc/guc.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2004-08-05 23:32:13 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2004-08-05 23:32:13 +0000
commitbdf8ef6925de6ea1a9330fa1ce32e1a315d07eb2 (patch)
tree80d8dd5dd82a93e69e3e0133ffdca0a7c03ea893 /src/backend/utils/misc/guc.c
parentb4cd416ab0003483cbf5467974ead4732357b17d (diff)
downloadpostgresql-bdf8ef6925de6ea1a9330fa1ce32e1a315d07eb2.tar.gz
postgresql-bdf8ef6925de6ea1a9330fa1ce32e1a315d07eb2.zip
Create a built-in log rotation program, so that we no longer have to
recommend that people go get Apache's rotatelogs program. Additional benefits are that configuration is done through GUC, rather than externally, and that the postmaster can monitor the log rotator and restart it after failure (though we certainly hope that won't happen often). Andreas Pflug, some rework by Tom Lane.
Diffstat (limited to 'src/backend/utils/misc/guc.c')
-rw-r--r--src/backend/utils/misc/guc.c68
1 files changed, 56 insertions, 12 deletions
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 22df3effc32..a827653bec4 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.225 2004/07/28 14:23:29 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.226 2004/08/05 23:32:12 tgl Exp $
*
*--------------------------------------------------------------------
*/
@@ -44,6 +44,7 @@
#include "parser/parse_expr.h"
#include "parser/parse_relation.h"
#include "postmaster/bgwriter.h"
+#include "postmaster/syslogger.h"
#include "postmaster/postmaster.h"
#include "storage/bufmgr.h"
#include "storage/fd.h"
@@ -801,19 +802,13 @@ static struct config_bool ConfigureNamesBool[] =
&default_with_oids,
true, NULL, NULL
},
-
{
- {"integer_datetimes", PGC_INTERNAL, COMPILE_OPTIONS,
- gettext_noop("Datetimes are integer based"),
- NULL,
- GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE
+ {"redirect_stderr", PGC_POSTMASTER, LOGGING_WHERE,
+ gettext_noop("Start a subprocess to capture stderr output into log files"),
+ NULL
},
- &integer_datetimes,
-#ifdef HAVE_INT64_TIMESTAMP
- true, NULL, NULL
-#else
+ &Redirect_stderr,
false, NULL, NULL
-#endif
},
#ifdef WAL_DEBUG
@@ -828,6 +823,20 @@ static struct config_bool ConfigureNamesBool[] =
},
#endif
+ {
+ {"integer_datetimes", PGC_INTERNAL, COMPILE_OPTIONS,
+ gettext_noop("Datetimes are integer based"),
+ NULL,
+ GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE
+ },
+ &integer_datetimes,
+#ifdef HAVE_INT64_TIMESTAMP
+ true, NULL, NULL
+#else
+ false, NULL, NULL
+#endif
+ },
+
/* End-of-list marker */
{
{NULL, 0, 0, NULL, NULL}, NULL, false, NULL, NULL
@@ -1246,6 +1255,24 @@ static struct config_int ConfigureNamesInt[] =
},
{
+ {"log_rotation_age", PGC_SIGHUP, LOGGING_WHERE,
+ gettext_noop("Automatic logfile rotation will occur after N minutes"),
+ NULL
+ },
+ &Log_RotationAge,
+ 24*60, 0, INT_MAX, NULL, NULL
+ },
+
+ {
+ {"log_rotation_size", PGC_SIGHUP, LOGGING_WHERE,
+ gettext_noop("Automatic logfile rotation will occur after N kilobytes"),
+ NULL
+ },
+ &Log_RotationSize,
+ 10*1024, 0, INT_MAX, NULL, NULL
+ },
+
+ {
{"max_function_args", PGC_INTERNAL, COMPILE_OPTIONS,
gettext_noop("Shows the maximum number of function arguments"),
NULL,
@@ -1634,6 +1661,23 @@ static struct config_string ConfigureNamesString[] =
&log_destination_string,
"stderr", assign_log_destination, NULL
},
+ {
+ {"log_directory", PGC_SIGHUP, LOGGING_WHERE,
+ gettext_noop("Sets the destination directory for logfiles."),
+ gettext_noop("May be specified as relative to the cluster directory "
+ "or as absolute path.")
+ },
+ &Log_directory,
+ "pg_log", NULL, NULL
+ },
+ {
+ {"log_filename_prefix", PGC_SIGHUP, LOGGING_WHERE,
+ gettext_noop("Prefix for file names created in the log_directory."),
+ NULL
+ },
+ &Log_filename_prefix,
+ "postgresql-", NULL, NULL
+ },
#ifdef HAVE_SYSLOG
{
@@ -5055,7 +5099,7 @@ assign_log_destination(const char *value, bool doit, GucSource source)
char *rawstring;
List *elemlist;
ListCell *l;
- unsigned int newlogdest = 0;
+ int newlogdest = 0;
/* Need a modifiable copy of string */
rawstring = pstrdup(value);