rsyslog/plugins/ompgsql/createDB.sql
James Le Cuirot ee54d0e4dc fix broken PostgreSQL database creation
Quoting is really really important under PostgreSQL. Giving the
database name in single quotes simply won't work. Giving it in double
quotes is not the same as not quoting it at all. rsyslog has
traditionally connected case-sensitively to "Syslog" but accessed the
tables case-insensitively so we should follow suit here.

Furthermore, you cannot create a table based on template1 with a
different encoding. template0 must be used instead.
2014-06-13 17:20:50 +01:00

38 lines
1.1 KiB
SQL

CREATE DATABASE "Syslog" WITH ENCODING 'SQL_ASCII' TEMPLATE template0;
\c Syslog;
CREATE TABLE SystemEvents
(
ID serial not null primary key,
CustomerID bigint,
ReceivedAt timestamp without time zone NULL,
DeviceReportedTime timestamp without time zone NULL,
Facility smallint NULL,
Priority smallint NULL,
FromHost varchar(60) NULL,
Message text,
NTSeverity int NULL,
Importance int NULL,
EventSource varchar(60),
EventUser varchar(60) NULL,
EventCategory int NULL,
EventID int NULL,
EventBinaryData text NULL,
MaxAvailable int NULL,
CurrUsage int NULL,
MinUsage int NULL,
MaxUsage int NULL,
InfoUnitID int NULL ,
SysLogTag varchar(60),
EventLogType varchar(60),
GenericFileName VarChar(60),
SystemID int NULL
);
CREATE TABLE SystemEventsProperties
(
ID serial not null primary key,
SystemEventID int NULL ,
ParamName varchar(255) NULL ,
ParamValue text NULL
);