问题描述
我正在尝试确定在我的应用程序中审核日志记录的最佳方法.日志的主要原因是报告事件(更改)的顺序.
I am trying to decide on the best method for audit logging within my application. The main reason for the log is reporting the sequence of events (changes).
我有一个对象层次结构,我需要在以后某个层次结构的任何部分发生变化时创建报告.
I have a hierarchy of Objects, I need to create reports when something changes on any part of that hierarchy, at a latter date.
我认为我有三个选择:
- 为每个表创建一个日志,从而匹配对象的层次结构,然后为报告创建一个视图.
- 扁平化层次结构和非规范化表格,使报告更容易 - 简单的选择语句.
- 有一个日志表,并为每个更改记录一条记录,这使得报告更难但对更改更灵活.
我目前倾向于选项 1.
I am currently leaning towards option 1.
推荐答案
审核日志基本上是按时间顺序排列的已发生事件、谁执行这些事件以及事件是什么的列表.
An audit log is basically a chronological list of events that occurred, who performed these events, and what the events were.
我认为平面视图会更好,因为它可以轻松订购和查询.所以我更倾向于你的选项#2/#3.
I think a flat view would be better as it can be easily ordered and queried. So I'm leaning more towards your option #2/#3.
包括交易类型、时间、用户 ID、更改内容的描述以及与您的产品相关的其他相关信息等内容.
Include things like the transaction type, the time, the user id, a description of what's changed, and other pertinent information related to your product.
您还可以随着时间的推移向产品中添加内容,而无需不断修改审核日志模块.
You can also add things to your product over time and you won't need to continually modify your audit log module.
这篇关于审计日志策略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!