libtblog.sql 4.83 KB
Newer Older
Kevin Atkinson's avatar
Kevin Atkinson committed
1 2 3 4
-- MYSQL TABLES used for logging subsystem

CREATE TABLE log (
  seq int unsigned NOT NULL auto_increment,
5
  stamp int unsigned NOT NULL,   -- timestamp
Kevin Atkinson's avatar
Kevin Atkinson committed
6 7 8 9 10
  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
11 12
  level tinyint(2) NOT NULL   ,  -- depth of the script in the call chain
  sublevel tinyint(2) NOT NULL,  -- sub level
Kevin Atkinson's avatar
Kevin Atkinson committed
13 14 15 16 17 18 19
  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
20
  cause varchar(16) NOT NULL,    -- string identifying the cause of the error
21
  type enum('normal','entering','exiting','thecause','extra','summary') 
Kevin Atkinson's avatar
Kevin Atkinson committed
22 23 24 25
       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)
26 27
                                 -- thecause: no longer used, see the 
				 --   "errors" table
28 29 30 31
				 -- extra: extra information to normal info
				 --   at a lower level
				 -- summary: useful summary of errors,
				 --   ignore all info at lower levels
Kevin Atkinson's avatar
Kevin Atkinson committed
32 33 34 35 36 37 38
  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)
);

39 40 41 42 43 44 45
CREATE TABLE session_info (
  session int NOT NULL,         -- session id (1)
  uid int default NULL,         -- numeric user id
  exptidx int NOT NULL,         -- unique experment id
  PRIMARY KEY  (session)
);

Kevin Atkinson's avatar
Kevin Atkinson committed
46 47 48 49 50 51 52 53 54
-- (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.

55
-- NOTE: It may be beneficial to factor out "invocation" specific info:
Kevin Atkinson's avatar
Kevin Atkinson committed
56 57 58 59
--   invocation session parent script level 
--   seq stamp [session] invocation priority inferred cause type relevant mesg
-- ...

60 61 62 63 64 65 66 67 68 69 70 71 72 73
CREATE TABLE errors (
  session int unsigned NOT NULL, -- session id
  stamp int unsigned NOT NULL,   -- timestamp
  exptidx int NOT NULL,          -- unique experment id
  script smallint(3) NOT NULL,   -- numeric id for the script name
  cause varchar(16) NOT NULL,    -- string identifying the cause of the error
  confidence float NOT NULL,     -- number between 0 and 1 indicating how
                                 --   confident tblog is that this it 
                                 --   correctly identified the error.
  mesg text NOT NULL,            -- the text of the message
  primary key (session)
);


Kevin Atkinson's avatar
Kevin Atkinson committed
74 75
CREATE TABLE scripts (
  script smallint(3) NOT NULL auto_increment,
76
  script_name varchar(24) NOT NULL default '',
Kevin Atkinson's avatar
Kevin Atkinson committed
77
  PRIMARY KEY  (script),
78
  UNIQUE KEY id (script_name)
Kevin Atkinson's avatar
Kevin Atkinson committed
79 80 81 82
);

CREATE TABLE priorities (
  priority smallint(3) NOT NULL,
83
  priority_name varchar(8) NOT NULL,
Kevin Atkinson's avatar
Kevin Atkinson committed
84
  primary key (priority),
85 86 87 88 89 90 91 92
  unique key (priority_name)
);

CREATE TABLE causes (
  cause varchar(16) NOT NULL,
  cause_desc varchar(32) NOT NULL,
  primary key (cause)
  unique key (cause_desc)
Kevin Atkinson's avatar
Kevin Atkinson committed
93 94
);

95 96 97 98 99 100 101

alter table experiment_stats
  add last_error int unsigned; -- session id of last error, otherwise 0

alter table testbed_stats
  add log_session int unsigned;

102 103 104 105 106 107 108 109
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');
110

111 112 113 114 115 116 117 118 119 120
replace into causes values ('temp', 'Temp Resource Shortage');
replace into causes values ('user', 'User Error');
replace into causes values ('internal', 'Internal Error');
replace into causes values ('software', 'Software Problem');
replace into causes values ('hardware', 'Hardware Problem');
replace into causes values ('unknown', 'Cause Unknown');

replace into exported_tables values ('priorities');
replace into exported_tables values ('causes');

121
replace into exported_tables values ('state_timeouts');
122 123 124