best practice - loging events (general) and changes (database)
Posted
by b0x0rz
on Stack Overflow
See other posts from Stack Overflow
or by b0x0rz
Published on 2010-05-09T12:23:01Z
Indexed on
2010/05/09
12:28 UTC
Read the original article
Hit count: 273
need help with logging all activities on a site as well as database changes.
requirements: * should be in database * should be easily searchable by initiator (user name / session id), event (activity type) and event parameters
i can think of a database design but either it involves a lot of tables (one per event) so i can log each of the parameters of an event in a separate field OR it involves one table with generic fields (7 int numeric and 7 text types) and log everything in one table with event type field determining what parameter got written where (and hoping that i don't need more than 7 fields of a certain type, or 8 or 9 or whatever number i choose)...
example of entries (the usual things):
[username] login failed @datetime
[username] login successful @datetime
[username] changed password @datetime, estimated security of password [low/ok/high/perfect] @datetime
[username] clicked result [result number] [result id] after searching for [search string] and got [number of results] @datetime
[username] clicked result [result number] [result id] after searching for [search string] and got [number of results] @datetime
[username] changed profile name from [old name] to [new name] @datetime
[username] verified name with [credit card type] credit card @datetime
datbase table [table name] purged of old entries @datetime
etc...
so anyone dealt with this before? any best practices / links you can share?
i've seen it done with the generic solution mentioned above, but somehow that goes against what i learned from database design, but as you can see the sheer number of events that need to be trackable (each user will be able to see this info) is giving me headaches, BUT i do LOVE the one event per table solution more than the generic one.
any thoughts?
edit: also, is there maybe an authoritative list of such (likely) events somewhere?
thnx
stack overflow says: the question you're asking appears subjective and is likely to be closed.
my answer: probably is subjective, but it is directly related to my issue i have with designing a database / writing my code, so i'd welcome any help. also i tried narrowing down the ideas to 2 so hopefully one of these will prevail, unless there already is an established solution for these kinds of things.
© Stack Overflow or respective owner