I've seen that some of software systems have functionality of audit and log. Both of those functionality seem that they are just doing the same things - records all the users's actions behind the scene. There are respective tables of audit and log even exist in the database. If they are really doing the same things why the developer developed duplicated function in a system?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
From what I have worked on, there is a difference between them based on their nature. A log is (may be) perishable while an audit trail is secure and non-perishable. As a result, you will never log sensitive information or information which you will need later. An audit trail on the other hand, is secure. It is something that should not be perished easily.
For example, in a bank software you will audit the transactions credit-debit, failed transactions etc. This audit will be stored in the database. The log file may save the transaction that crashed when the software failed and did not enter the system.
i use audit to trace the users actions, and to reconstruct current values.
for instance, we have a table with giftcardvalues, and we can see in that table that the current value is $100 and the original value $200.
Is that correct, we don't know....
for that question to be answered we have to know what happened in between.
so we have a audit table in which we save all actions for that table, like this:
jan. 1 init $200
jan. 3 add $300
jan. 5 subtract $350
jan. 7 check value (returned 150)
jan. 8 subtract $50
now i know what to say if a user calls and says: hey, where did my $100 go?
'normal' logging is used to log errors, process info etc. wo we can debug the app when, for instance, the audit info and the actual values for the giftcard don't match, so we can see what is going wrong in the code.