Add asset host logs ingest and UI
This commit is contained in:
1
migrations/0023_machine_event_logs/down.sql
Normal file
1
migrations/0023_machine_event_logs/down.sql
Normal file
@@ -0,0 +1 @@
|
||||
DROP TABLE IF EXISTS machine_event_logs;
|
||||
27
migrations/0023_machine_event_logs/up.sql
Normal file
27
migrations/0023_machine_event_logs/up.sql
Normal file
@@ -0,0 +1,27 @@
|
||||
CREATE TABLE machine_event_logs (
|
||||
id VARCHAR(16) NOT NULL,
|
||||
machine_id VARCHAR(16) NOT NULL,
|
||||
log_source ENUM('host', 'bmc', 'redfish') NOT NULL,
|
||||
fingerprint CHAR(64) NOT NULL,
|
||||
event_time DATETIME(3) NOT NULL,
|
||||
severity VARCHAR(64) NULL,
|
||||
message_id VARCHAR(255) NULL,
|
||||
message TEXT NOT NULL,
|
||||
component_ref VARCHAR(255) NULL,
|
||||
is_active BOOLEAN NULL,
|
||||
raw_payload_json JSON NULL,
|
||||
first_seen_at DATETIME(3) NOT NULL,
|
||||
last_seen_at DATETIME(3) NOT NULL,
|
||||
seen_count INT NOT NULL DEFAULT 1,
|
||||
created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
||||
updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY uq_machine_event_logs_dedupe (machine_id, log_source, fingerprint),
|
||||
KEY idx_machine_event_logs_machine_time (machine_id, event_time DESC, id DESC),
|
||||
KEY idx_machine_event_logs_machine_source (machine_id, log_source, event_time DESC, id DESC),
|
||||
CONSTRAINT fk_machine_event_logs_machine
|
||||
FOREIGN KEY (machine_id) REFERENCES machines(id)
|
||||
ON DELETE CASCADE ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
INSERT IGNORE INTO id_sequences (entity_type, next_value) VALUES ('machine_event_log', 1);
|
||||
Reference in New Issue
Block a user