--- src/man/om_pgsql.8.orig Fri Mar 1 07:31:02 2002 +++ src/man/om_pgsql.8 Mon Oct 25 13:06:47 2004 @@ -63,7 +63,7 @@ .It Fl d Ar database The database name to use on the specified PostgreSQL server. .It Fl t Ar table -The table name to use on the specified PostgreSQL database. +The table name to use on the specified PostgreSQL database. syslog if not specifyed. .It Fl F Insert the facility level name on the table on a field named "facility" .It Fl P @@ -81,17 +81,14 @@ The table should have a format like this: .Pp .Bd -literal - CREATE TABLE syslogTB ( - facility char(10), - priority char(10), - date date, - time time, - host varchar(128), - message text + CREATE TABLE syslog ( + time timestamp, # time of this message + host text, # host logging + mesg text # message ); .Ed .Pp -The field names should be resected. The type of fields +The field names are fixed. The type of fields .Va host and .Va msg --- src/modules/om_pgsql.c.orig Fri Mar 1 07:31:03 2002 +++ src/modules/om_pgsql.c Mon Oct 25 13:09:53 2004 @@ -171,9 +171,9 @@ snprintf(priority, sizeof(priority), "'%d',", m->pri); } - /* table, YYYY-Mmm-dd, hh:mm:ss, host, msg */ - i = snprintf(query, sizeof(query), "INSERT INTO %s (%s%sdate, time, " - "host, message) VALUES(%s%s'%.4d-%.2d-%.2d', '%.2d:%.2d:%.2d', '%s', '", + /* table, YYYY-Mmm-dd hh:mm:ss, host, msg */ + i = snprintf(query, sizeof(query), "INSERT INTO %s(time, host, mesg)" + " VALUES('%.4d-%.2d-%.2d %.2d:%.2d:%.2d', '%s', '", c->table, c->table, (c->flags & OM_PGSQL_FACILITY)? "facility, " : "", (c->flags & OM_PGSQL_PRIORITY)? "priority, " : "", @@ -280,7 +280,7 @@ return (-1); user = NULL; passwd = NULL; db = NULL; port = 0; host = NULL; - table = NULL; + table = "syslog"; /* save handle and stuff on context */ if (! (*c = calloc(1, sizeof(struct om_pgsql_ctx)))) @@ -367,7 +367,7 @@ argcnt++; } - if (user == NULL || db == NULL || table == NULL) { + if if (table == NULL) { dprintf(MSYSLOG_SERIOUS, "om_pgsql_init: Error missing " "params!\n"); dlclose(ctx->lib);