Added StoredProcedure LogMessageAdd for Logging
This commit is contained in:
parent
54a0eae651
commit
0517f7b803
@ -210,10 +210,10 @@ FOREIGN KEY (credentials_credentials_id) REFERENCES Credentials (credentials_id)
|
||||
CREATE TABLE IF NOT EXISTS v_logentries (
|
||||
v_logentries_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
pod VARCHAR(1000),
|
||||
location VARCHAR(1000)
|
||||
location VARCHAR(1000),
|
||||
hostname VARCHAR(45),
|
||||
severity INT,
|
||||
timestamp TIMESTAMP;
|
||||
timestamp TIMESTAMP,
|
||||
message VARCHAR(1000)
|
||||
);
|
||||
|
||||
@ -238,6 +238,23 @@ BEGIN
|
||||
END //
|
||||
DELIMITER ;
|
||||
|
||||
# Stored Procedure für schreiben der Logs Anhand der Inputparameter
|
||||
|
||||
DELIMITER //
|
||||
CREATE PROCEDURE LogMessageAdd
|
||||
(
|
||||
IN device_id INT, log_level ENUM('Low','Middle','High'), logMessageInsert VARCHAR(255)
|
||||
)
|
||||
|
||||
BEGIN
|
||||
|
||||
INSERT INTO log ( device_fk, `timestamp`, logMessage, `level`, is_acknowledged)
|
||||
VALUE
|
||||
(device_id, timestamp(now()), logMessageInsert, log_level, 0);
|
||||
|
||||
END //
|
||||
DELIMITER ;
|
||||
|
||||
# View für das anzeigen nicht belegter Interfaces
|
||||
CREATE VIEW
|
||||
view_freiesInterface (LocationName, Hostname, Portnummer, Medium, Geschwindigkeit)
|
||||
|
@ -127,9 +127,9 @@ VALUES
|
||||
INSERT INTO Log (logMessage, timestamp, level, is_acknowledged, device_fk)
|
||||
VALUES
|
||||
('Loged In',now(),'Low',0,1),
|
||||
('Loged Out',now(),'Low'0,,1),
|
||||
('Loged In',now(),'Low'0,,2),
|
||||
('Virus detected',now(),'High'0,,3)
|
||||
('Loged Out',now(),'Low',0,1),
|
||||
('Loged In',now(),'Low',0,2),
|
||||
('Virus detected',now(),'High',0,3)
|
||||
;
|
||||
|
||||
INSERT INTO Abrechnung (kundenkonto_fk, location_fk, device_fk, interface_fk)
|
||||
|
Loading…
Reference in New Issue
Block a user