libtblog-orig.sql 3.11 KB
Newer Older
Kevin Atkinson's avatar
   
Kevin Atkinson committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
-- MYSQL TABLES used for logging subsystem

CREATE TABLE log (
  seq int unsigned NOT NULL auto_increment,
  stamp int unsigned NOT NULL,
  pidx int NOT NULL,             -- unique project id
  uid  int default NULL,         -- numeric user id
  session int unsigned NOT NULL, -- session id (1)
  invocation int unsigned NOT NULL, -- invocation id - unique id for a 
                                 --   particular execution of a script (1)
  parent int unsigned NOT NULL,  -- invocation id of the parent script
  script smallint(3) NOT NULL,   -- numeric id for the script name
  level smallint(2) NOT NULL   , -- depth of the script in the call chain
  priority smallint(3) NOT NULL, -- syslog priority
  inferred tinyint(1) NOT NULL,  -- 0 - log created with tblog
                                 -- 1 - log created by catching a die or warn
				 -- 2 - log created with a normal print and
                                 --     given the non-default priority
                                 -- 3 - log created with a normal print and
                                 --     given the default priority
  cause varchar(32) NOT NULL,    -- string identifying the "cause" of the error
  type enum('normal','entering','exiting','thecause') 
       NOT NULL default 'normal',-- type of error:
                                 -- normal: normal error generated by tblog
                                 -- entering: auto gen when a script starts
				 -- exiting:  auto gen when a script exists (2)
                                 -- thecause: created by tblog_find_error
  relevant tinyint(1) NOT NULL,  -- if the error was considered relevent
                                 -- by tblog_find_error
  mesg text NOT NULL,            -- the text of the message
  PRIMARY KEY (seq),
  KEY (session)
);

-- (1) These ids are equal to the sequence number of the "entering" log
--     message
-- (2) Due to a number of factors every "exiting" message in not 
--     garanteed to have a 1-1 relation with the "entering" message.
--     The two major ones are
--     (1) A Fork not followed by a "exec" will most likely to cause
--     multiple exiting messages.  (2) If "exec" is used the script
--     will not have an exiting message.

-- NOTE: It may be beneficial to split this table into three:
--   session pidx uid
--   invocation session parent script level 
--   seq stamp [session] invocation priority inferred cause type relevant mesg
-- ...

CREATE TABLE scripts (
  script smallint(3) NOT NULL auto_increment,
  name varchar(24) NOT NULL default '',
  PRIMARY KEY  (script),
  UNIQUE KEY id (name)
);

CREATE TABLE priorities (
  priority smallint(3) NOT NULL,
  name varchar(8) NOT NULL,
  primary key (priority),
  unique key (name)
);

Leigh B. Stoller's avatar
Leigh B. Stoller committed
64
65
66
67
68
69
70
71
replace into priorities values (000, 'EMERG');
replace into priorities values (100, 'ALERT');
replace into priorities values (200, 'CRIT');
replace into priorities values (300, 'ERR');
replace into priorities values (400, 'WARNING');
replace into priorities values (500, 'NOTICE');
replace into priorities values (600, 'INFO');
replace into priorities values (700, 'DEBUG');
Kevin Atkinson's avatar
   
Kevin Atkinson committed
72

Leigh B. Stoller's avatar
Leigh B. Stoller committed
73
replace into exported_tables values ('state_timeouts');