Welcome Guest, Not a member yet? Register   Sign In
Audit Trial
#1

Hi All,

Does anybody knows about audit logging or audit trail in CI? Any plugin that's already available? I wonder why no plugin available in detail.

I need to be able to log all changes from INSERT/UPDATE/DELETE on every table.
This must include table name, field old value, field new value and user.

Appreciate if anybody can give me an idea.

Thanks,
Reply
#2

(This post was last modified: 11-27-2017, 09:31 AM by PaulD. Edit Reason: Added links )

Well I know of two ways. One is to have a history table that has something like affected id, old value, new value, date changed, table affected, userid etc etc. Whenever you do a table function, you write a history record for it. I have done this but rolling back is a pain, and the table gets very big very quickly.

The other I have only read about is that MySQL offers features where whenever a table operation happens, a record is written to keep track of it. This is done on the database itself so it cannot be bypassed and is independent of the script interacting with the database.

I will google for it and see if I can find it again and will post it here if I can find it.

Paul.

PS I imagine that no scripts are available because it is such an app dependent thing that no script would work from one site to another. ie pretty difficult to generalise.

EDIT
https://dev.mysql.com/doc/refman/5.7/en/triggers.html
https://stackoverflow.com/questions/1143...-a-history
Again, I have no experience of doing this but it looked interesting, so these links might not be overly useful. Cannot find the article I read about this which was a shame.

Found another thing on github
https://github.com/dan-da/cdc_audit
Reply




Theme © iAndrew 2016 - Forum software by © MyBB