How to write DB2 DDL & DML audit logs as System Application Logs?

家住魔仙堡 提交于 2019-12-11 15:10:00

问题


I am using DB2 LUW in a windows machine. I want to get the logs for DDL & DML queries used in the database.

The default logs(for example S000001.LOG) contains 'null' and not in a readable format. So I enabled auditing and extracted the archived audit logs into .del files.

But the audit log extraction creates .del like this:

execute.del

"2019-09-05-01.19.44.443001","EXECUTE","STATEMENT",13,0,"TEST2","Administrator","ADMINISTRATOR","ADMINISTRATOR",,,"*LOCAL.DB2.190904193137","db2bp.exe",,,,,,,,"ADMINISTRATOR","SQLC2O29",203,," "," ",10,1,0,0,"WRITE_DML","auditlobs.0.42/","CS","auditlobs.42.808/",1,0,,,,,,"2019-09-05-01.19.44.178765",,"DB2","DESKTOP-R9O62O0"

the empty spaces are like NULNULNUL while opening the file in notepad++

auditlob.file

insert into db2admin.testtable values(223)GEN_CMPL ( DD ( ¸ 0 ¸ 8 ¸ @ ¸ H ¸ P ¸
X ¸

This file contains characters like STX NUL EOX US... etc

In my case either I should get the logs in any readable format(Like db2diag.log file) or I have to forward the logs to a syslog server in a standard format.

What is the best way to do it?

Is there any possibility to write the audit logs as System Application Events Like MSSQL DDL/DML Auditing? so that I could easily forward those logs.

auditlobs.file and execute.del -> https://imgur.com/a/9LydhYK

Thanks in advance..!


回答1:


These CSV files may be imported or loaded into Db2 tables for further analysis / processing.
You may use any other tools with an ability to process CSV files and log their contents to whatever system.



来源:https://stackoverflow.com/questions/57818297/how-to-write-db2-ddl-dml-audit-logs-as-system-application-logs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!