Add asset host logs ingest and UI

This commit is contained in:
Mikhail Chusavitin
2026-03-15 21:38:20 +03:00
parent 5370c1a698
commit f4cd15f0c4
19 changed files with 1374 additions and 222 deletions

View File

@@ -0,0 +1 @@
DROP TABLE IF EXISTS machine_event_logs;

View 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);