Is there any way to programmatically access the PI Audit table? We have... many servers and I'll like to develop an app to audit the tables, consolidate the results, and send it to team members for review.
According to this thread: techsupport.osisoft.com/.../KB00629
You can use the AuditViewer to export your results to XML.
pidiag -xa d:\pi\log\PIBasessAudit.dat
So if you count-in some scripting on each server, then yes, programmatic access is possible. But not through PISDK, AFSDK, OLEDB or OLEDBEnterprise.
Although I have not tested it, you should be able to write a Windows PowerShell script to get the logs from PI Audit by executing pidiag and sending the results to a SQL Server database. If you run the same script on each PI Data Archive, you can have all logs information centralized on a single database. Again, I have never done it, but it should work. Then, you will be able to develop your app and of course create custom reports.
Hope it helps!
'PIDIAG.exe -XA' has some rather severe functional limitations for time series data. The most severe limitation is that the resulting output XML never includes any user information for any of the archive records. Unlike 'PIDIAG.exe -XA', PI AuditViewer tries to match the attempts from the Snapshot trail (pisnapssAudit.dat) with the records in the Archive trail (piarchssAudit.dat) to provide user information, but this did not really work that well until PI AuditViewer 2012 SP1 (1.4.5), which just got released 6 weeks ago (June 17, 2014). PI AuditViewer does allow you to export audit files to CSV, but PI AuditViewer does not have a built-in automation interface and must still run locally on the PI Data Archive computer. In theory, you could write some coded-UI application to drive the UI of PI AuditViewer in an automated fashion, but this is hardly a first-class programmatic experience that can serve as a solid foundation for building custom reports.
Unfortunately, remote and programmatic access to the audit trail of the PI Data Archive remains an outstanding enhancement request.
Thank you all for the replies. Specifically, I am looking more to audit PI Points than data, but, knowing that I will have to use PIDiag on each server (60 at last count), helps. It will take time, but I should be able to write a script that dumps the data to a CSV file, copy said file to a network location and process from there.
If you are just auditing the configuration trail (pibasessAudit.dat) for things like PI Points, then you will have the user information from 'pidiag -xa'.
Just to clarify: 'pidiag -xa' outputs XML. PI AuditViewer exports CSV. Thus, if you use 'pidiag -xa', and you desire a CSV file, then you will need to transform from XML to CSV in a separate step.
Retrieving data ...