audit

how to send parameters to trigger in Oracle

浪子不回头ぞ 提交于 2019-12-10 07:25:33
问题 The purpose is to send extra information to triggers like current user id from a web application. Since a connection pool is used, and same user id is used for all connections how do I pass the original web user id to trigger? It is a java based application. 回答1: If you can't touch the application code and the application itself does not pass this information to the database already, you're at an impasse. The only way to make that information available to back-end code is for the middle tier

How to audit a Java EE project?

倖福魔咒の 提交于 2019-12-10 04:06:45
问题 I've to audit the code-architecture quality and maintainability (in the end to be sure we have what we paid for) a Java EE web project based on JSF/CDI/EJB3.0/JPA (just to name some of the technologies involved). This may not be the right place to ask but how do you deal with this kind of task? Basically, I would proceed from coarse-grained to fine-grained, i.e. from the whole architecture to the java code. Is it better to deal with each layer completely? Should I spend more time on the low

Counting the number of deleted rows in a SQL Server stored procedure

こ雲淡風輕ζ 提交于 2019-12-09 07:23:08
问题 In SQL Server 2005, is there a way of deleting rows and being told how many were actually deleted? I could do a select count(*) with the same conditions, but I need this to be utterly trustworthy. My first guess was to use the @@ROWCOUNT variables - but that isn't set, e.g. delete from mytable where datefield = '5-Oct-2008' select @@ROWCOUNT always returns a 0. MSDN suggests the OUTPUT construction, e.g. delete from mytable where datefield = '5-Oct-2008' output datefield into #doomed select

Trigger for insert, update, delete

懵懂的女人 提交于 2019-12-08 21:56:07
问题 I want to insert rows into the audit table whenever an insert, update or delete takes place in the master table "Table1" - doesn't matter which column is changed/inserted. I also want to add I, U or D on insert, update or delete. For insert and delete I am checking if rows exist in the inserted and deleted table. What is the best way to approach update. My code for insert and delete is : CREATE TRIGGER [dbo].[tr_Table1_InsertUpdate_Table1History_Insert] ON [dbo].[Table1] FOR INSERT, DELETE,

Hibernate envers custom revision entity

北慕城南 提交于 2019-12-07 17:50:54
问题 I'm trying to extend my revision table. Following the manual I created custom revision entity: package com.terminal.audit; import org.hibernate.envers.DefaultRevisionEntity; import org.hibernate.envers.RevisionEntity; import org.hibernate.envers.RevisionNumber; import org.hibernate.envers.RevisionTimestamp; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Transient; import java.util.Date; @Entity @RevisionEntity

Hold Old and New value in SaveChange as DbEntityEntry.Entity to Audit

那年仲夏 提交于 2019-12-07 02:32:27
As you know we can Audit object in SaveChange() but I have some problem with Modified and Deleted entities as following, First I am using Audit.Net (this is very simple to use) to Audit my objects the below method should do audit as: private int SaveAuditRecord(DbEntityEntry dbEntry, string userGUID) { Logging.Log(LoggingMode.Error, "Saving Audid Entry{0}....", dbEntry.ToString()); DateTime changeTime = DateTime.UtcNow; TableAttribute tableAttr = dbEntry.Entity.GetType().GetCustomAttributes(typeof(TableAttribute), true).SingleOrDefault() as TableAttribute; string tableName = tableAttr != null

How to decode this information from strace output

我是研究僧i 提交于 2019-12-07 01:47:22
问题 I wrote a small go script and traced it using strace though this script, I am trying to fetch audit messages from kernel using netlink protocol, just like like auditd. Following is the strace output on my go script- http://paste.ubuntu.com/8272760/ I am trying to find the argument that auditd provide to the sendto function. When I run strace on auditd I get following output sendto(3, "\20\0\0\0\350\3\5\0\1\0\0\0\0\0\0\0", 16, 0, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 16 And

Hibernate Envers - Get Fields that have changed

筅森魡賤 提交于 2019-12-06 19:37:28
问题 I have a rather complicated DB structure that I am trying to audit. Currently I have Envers running and it audits the changes that are made to each object. This works really well! I now want to show some audit information on the UI. The objects/tables get quite complicated so I was looking for a way to see what fields have changed in the audit. Currently Envers stores a snapshot of each object stamped with a revision id. I can look at each object's revision and then manually query to see what

Need an abstract trigger in MySQL 5.1 to update an audit log

旧时模样 提交于 2019-12-06 12:04:04
I need a way to check for and pass entries into an audit log for any entries in a table that have been changed. It needs to be abstracted away from the table structure. For example: CREATE TRIGGER table1_update BEFORE UPDATE ON table1 FOR EACH ROW BEGIN DECLARE i_column_name varchar(32); DECLARE done INT; DECLARE cursor1 CURSOR FOR SELECT column_name FROM information_schema.columns WHERE table_name = 'table1'; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; OPEN cursor1; REPEAT FETCH cursor1 INTO i_column_name; IF NOT done THEN --pass the variable column_name and its old.i_column_name and

Audit history of multiple tables in the database

主宰稳场 提交于 2019-12-06 12:00:58
I have 3-4 tables in my database which I want to track the changes for. I am mainly concerned about updates. Whenever updates happen, I want to store previous entry (value or complete row) in audit table. Basic columns I was thinking of are as following: AuditId, TableName, PK1, PK2, PK3, PKVal1, PKVal2, PKVal3, UpdateType, PrevEntryJSON JSON will be of format: Key:Value and I preferred to go with it as columns keep on changing and I want to keep all values even if they don't change. Other option is to remove JSON with 100's of columns which will have names same as different columns