libtblog-orig.sql 3.26 KB
Newer Older
1 2 3 4
-- MYSQL TABLES used for logging subsystem

CREATE TABLE log (
  seq int unsigned NOT NULL auto_increment,
5
  stamp int(10) unsigned NOT NULL default '0',
6 7
  pidx int NOT NULL,             -- unique project id
  uid  int default NULL,         -- numeric user id
8 9
  session int(10) unsigned NOT NULL default '0', -- session id (1)
  invocation int(10) unsigned NOT NULL default '0', -- invocation id - unique id for a 
10
                                 --   particular execution of a script (1)
11 12 13 14 15
  parent int(10) unsigned NOT NULL default '0',  -- invocation id of the parent script
  script smallint(3) NOT NULL default '0',   -- numeric id for the script name
  level smallint(2) NOT NULL default '0', -- depth of the script in the call chain
  priority smallint(3) NOT NULL default '0', -- syslog priority
  inferred tinyint(1) NOT NULL default '0',  -- 0 - log created with tblog
16 17 18 19 20
                                 -- 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
21
  cause varchar(32) NOT NULL default '',    -- string identifying the "cause" of the error
22 23 24 25 26 27
  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
28
  relevant tinyint(1) NOT NULL default '0',  -- if the error was considered relevent
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
                                 -- 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 (
58 59
  priority smallint(3) NOT NULL default '0',
  name varchar(8) NOT NULL default '',
60 61 62 63
  primary key (priority),
  unique key (name)
);

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');
72

73
replace into exported_tables values ('state_timeouts');