I am attempting to overhaul my CRUD application's logging architecture. It is a .NET Winforms application with a SQL Server 2008 R2 backend.
In the current setup, a call is made to the database log any time the user presses a 'Save Button'. A changeset is determined using .NET reflection on classes that represent tables that we have stored in SQL.
The log is stored in two tables called ActionLogHeader and ActionLogDetail.
Header Schema:
ActionLogHeader_id | TableName | PrimaryKey | ActionType | User | ActionDate
Detail Schema:
ActionLogDetail_id | ActionLogHeader_id | ColumnChanged | PreValue | PostValue
There can be multiple Details for a single Header. Each detail row represents a single column that changed in a table. An ActionType is insert/update/delete/view.
This generally works for showing users a list of changes that happened to any one thing in our database. But it becomes difficult to pull data out of this to create a complete picture of what something looked like at any momemnt in time. Aggregates over this data for specific data points are difficult.
We've explored moving this data out of SQL Server and into Hadoop/HBase but I feel all we've done is move the data without changing the structure. We've flattened the table and added more columns so fetching data from SQL wouldn't be an issue. But doing any sort of analysis over the data still needs a MapReduce job which is a pain to set up.
So I'm interested in what other people are doing for logging. Is there a better strategy? I've seen that a lot of people like triggers at the database level for some change-logging but I don't know how that affects performance. I'm not sure where to go from here.