0

Been tasked with making an "Activity Log" or "History Page" for database transactions for our app, and I'd like to explore if it's possible to do this without touching the app itself much, except for display purposes.

Building off from this question (which I've had problems with), which makes use of TRIGGERS, is there a way to combine that with some form of query watcher, so that instead of having to use a history table per existing table, we can instead make use of a single history table that might look something like this?:

id      table_name      column_modified     action      data_before_modify      date_modified
1       game_data       season_data         "insert"    "beta season"           NOW()

Something like this?

DROP TRIGGER IF EXISTS game_data_insert;
CREATE TRIGGER game_data_insert AFTER INSERT ON game_data FOR EACH ROW
INSERT INTO history_table <Column_modified> "insert", <Data?>, NOW()

We're using MySQL on Amazon Web Service's RDS, if it means anything.

zack_falcon
  • 4,186
  • 20
  • 62
  • 108

1 Answers1

0

You can get access to various logs with regards of your RDS cluster/instance, see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_LogAccess.html

You can also stream those logs to CloudWatch and extract relevant data from it.

Adi Scorus
  • 11
  • 2
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Sep 25 '21 at 10:34