source: branches/samhain-2_2-branch/sql_init/samhain.postgres.init@ 82

Last change on this file since 82 was 35, checked in by rainer, 19 years ago

Fix concurrent inserts with postgres

File size: 2.6 KB
Line 
1CREATE SEQUENCE log_log_index_seq START 1;
2CREATE TABLE log (
3 log_index INTEGER NOT NULL,
4 log_ref BIGINT NULL,
5 log_host VARCHAR(64) NOT NULL DEFAULT 'localhost',
6 log_time TIMESTAMP NOT NULL,
7 log_sev VARCHAR(4) NOT NULL,
8 log_msg TEXT,
9
10 log_hash VARCHAR(32),
11
12 entry_status VARCHAR(16) NOT NULL DEFAULT 'NEW',
13
14 path TEXT,
15 userid VARCHAR(8),
16 grp VARCHAR(8),
17 program VARCHAR(8),
18 subroutine VARCHAR(16),
19 status VARCHAR(12),
20 hash VARCHAR(50),
21 path_data TEXT,
22 hash_data VARCHAR(50),
23 key_uid VARCHAR(64),
24 key_uid_data VARCHAR(64),
25 key_id VARCHAR(16),
26 module VARCHAR(8),
27 return_code INTEGER,
28 syscall VARCHAR(16),
29 ip VARCHAR(16),
30 tty VARCHAR(16),
31 peer VARCHAR(64),
32 fromhost VARCHAR(64),
33 obj TEXT,
34 interface VARCHAR(64),
35 time VARCHAR(64),
36 dir TEXT,
37 linked_path TEXT,
38 port INTEGER,
39 service VARCHAR(64),
40 facility VARCHAR(32),
41 priority VARCHAR(32),
42 syslog_msg TEXT,
43
44 mode_old VARCHAR(16),
45 mode_new VARCHAR(16),
46 attr_old VARCHAR(16),
47 attr_new VARCHAR(16),
48
49 device_old VARCHAR(16),
50 device_new VARCHAR(16),
51 owner_old VARCHAR(9),
52 owner_new VARCHAR(9),
53 group_old VARCHAR(9),
54 group_new VARCHAR(9),
55 ctime_old TIMESTAMP,
56 ctime_new TIMESTAMP,
57 atime_old TIMESTAMP,
58 atime_new TIMESTAMP,
59 mtime_old TIMESTAMP,
60 mtime_new TIMESTAMP,
61 chksum_old VARCHAR(50),
62 chksum_new VARCHAR(50),
63 link_old TEXT,
64 link_new TEXT,
65
66 size_old BIGINT,
67 size_new BIGINT,
68 hardlinks_old BIGINT,
69 hardlinks_new BIGINT,
70 inode_old BIGINT,
71 inode_new BIGINT,
72
73 imode_old BIGINT,
74 imode_new BIGINT,
75 iattr_old BIGINT,
76 iattr_new BIGINT,
77 idevice_old BIGINT,
78 idevice_new BIGINT,
79 iowner_old BIGINT,
80 iowner_new BIGINT,
81 igroup_old BIGINT,
82 igroup_new BIGINT
83
84 );
85
86
87CREATE UNIQUE INDEX log_log_index_key on log (log_index);
88CREATE INDEX ix_hash ON log (log_hash);
89
90CREATE INDEX ix_log_host ON log (log_host);
91CREATE INDEX ix_entry_status ON log (entry_status);
92
93GRANT INSERT ON log TO samhain;
94GRANT UPDATE ON log_log_index_seq TO samhain;
95GRANT SELECT ON log_log_index_seq TO samhain;
96
Note: See TracBrowser for help on using the repository browser.