Question: Consider the following security trigger - - Table for logging delete attempts CREATE TABLE audit _ log ( event _ id SERIAL PRIMARY KEY, event
Consider the following security trigger
Table for logging delete attempts
CREATE TABLE auditlog
eventid SERIAL PRIMARY KEY,
eventtime TIMESTAMP NOT NULL,
username TEXT NOT NULL,
tablename TEXT NOT NULL,
actiontaken TEXT NOT NULL
;
Trigger function to log delete attempts
CREATE OR REPLACE FUNCTION logdeleteattempt
RETURNS TRIGGER AS $$
BEGIN
INSERT INTO auditlogeventtime, username, tablename, actiontaken
VALUES now CURRENTUSER, TGTABLENAME, 'DELETE ATTEMPT';
RETURN OLD;
END;
$$ LANGUAGE plpgsql;
Trigger for delete attempts on sensitive table 'customerdata'
CREATE TRIGGER triggerlogdelete
BEFORE DELETE ON customerdata
FOR EACH ROW EXECUTE FUNCTION logdeleteattempt;
What does the auditlog table store?
Every login attempt by a user
Attempts to delete rows from the customerdata table
Every change to the database schema
All the INSERT operations in the database
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
