source: trunk/sql_init/samhain.postgres.init@ 479

Last change on this file since 479 was 392, checked in by katerina, 13 years ago

Fix for ticket #289 (Integer columns not initialized to handle unsigned 64bit in SQL DB).

File size: 2.7 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(46),
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 NUMERIC(20),
67 size_new NUMERIC(20),
68 hardlinks_old NUMERIC(20),
69 hardlinks_new NUMERIC(20),
70 inode_old NUMERIC(20),
71 inode_new NUMERIC(20),
72
73 imode_old NUMERIC(20),
74 imode_new NUMERIC(20),
75 iattr_old NUMERIC(20),
76 iattr_new NUMERIC(20),
77 idevice_old NUMERIC(20),
78 idevice_new NUMERIC(20),
79 iowner_old NUMERIC(20),
80 iowner_new NUMERIC(20),
81 igroup_old NUMERIC(20),
82 igroup_new NUMERIC(20),
83
84 acl_old TEXT,
85 acl_new TEXT
86 );
87
88
89CREATE UNIQUE INDEX log_log_index_key on log (log_index);
90CREATE INDEX ix_hash ON log (log_hash);
91
92CREATE INDEX ix_log_host ON log (log_host);
93CREATE INDEX ix_entry_status ON log (entry_status);
94
95GRANT INSERT ON log TO samhain;
96GRANT UPDATE ON log_log_index_seq TO samhain;
97GRANT SELECT ON log_log_index_seq TO samhain;
98
Note: See TracBrowser for help on using the repository browser.