审核日志删除的最佳方法是什么? [英] What's the best way to audit log DELETEs?

查看:55
本文介绍了审核日志删除的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

连接字符串上的用户标识不是变量,并且与程序的用户标识(例如,可以是GUID)不同.如果您的连接字符串的用户ID是静态的,您如何审核日志删除?

The user id on your connection string is not a variable and is different from the user id (can be GUID for example) of your program. How do you audit log deletes if your connection string's user id is static?

记录插入/更新/删除的最佳位置是通过触发器.但是使用静态连接字符串,很难记录谁删除了某些内容.有什么选择?

The best place to log insert/update/delete is through triggers. But with static connection string, it's hard to log who delete something. What's the alternative?

推荐答案

对于SQL Server,您可以使用CONTEXT_INFO将信息传递给触发器.

With SQL Server, you could use CONTEXT_INFO to pass info to the trigger.

我在必须使用触发器(例如,表上的多个写入路径)的代码中(由Web应用程序调用)使用此代码.这是无法将我的逻辑应用于存储过程的地方.

I use this in code (called by web apps) where I have to use triggers (eg multiple write paths on the table). This is where can't put my logic into the stored procedures.

这篇关于审核日志删除的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆