Job Auditing and SQL Queries

SkySync supports an Auditing feature that allows for full reporting of all writes, transfers and deletions performed by jobs. 

Because of the increased data collected and the size needed in the SkySync tracking database to record all of the audit data, the Auditing feature requires SkySync to use SQL Server or SQL Server Express. See the link below for a guide on configuring SkySync to use SQL Server

Audits can be viewed in the Job History Tab. To access the Job History from the Job Control screen, right-click on the job and select Job History, or highlight the job and select Job History from the pop up menu. Select the "Audits" tab in the lower section of the Execution History window:

 

 

If email notifications are configured, the job summary emailed will have a .csv attachment containing all of the audit data for that job run. 

Additionally, auditing data can be accessed with a SQL query or via the SkySync Web Service. The queries are listed below: 

 TSQL (SQL Server) query:


DECLARE @pageindex as Int = 0; 
DECLARE @pageSize as Int = 1000; 
DECLARE @offset as Int = @pageindex * @pageSize; 
WITH CTE AS ( 
       SELECT ID, JobID, ExecutionID, IsContainer, IsDirectionSwitched, ConnectionID, Path, DesiredName, Size, Version, SourceConnectionID, SourcePath, OperationType, OperationOnTicks, Reason, ROW_NUMBER() 
       OVER (ORDER BY OperationOnTicks DESC) r FROM TransferAudits 
) SELECT * FROM CTE WHERE r > @offset AND r <= (@offset + @pageSize);

 

 Omit CTE to query all data:


SELECTID, JobID, ExecutionID, IsContainer, IsDirectionSwitched, ConnectionID, Path, DesiredName, Size, Version, SourceConnectionID, SourcePath, OperationType, OperationOnTicks, Reason 
FROMTransferAudits 
ORDERBYOperationOnTicks DESC
 


 Links to retrieve/export the Auditing Data via the SkySync Web Service:

For these queries, the "pageSize" default and maximum are both 100.



Retrieve the first 100 audits:
 

http://localhost:9000/v1/jobs/executions/audits?sort=OperationOnTicks&desc=true&pageIndex=0&pageSize=100 

 

Retrieve the first 100 audits for job X: 

http://localhost:9000/v1/jobs/X/executions/audits?sort=OperationOnTicks&desc=true&pageIndex=0&pageSize=100 

 

Retrieve the first 100 audits for job X, execution ID of Y: 

http://localhost:9000/v1/jobs/X/executions/Y/audits?sort=OperationOnTicks&desc=true&pageIndex=0&pageSize=100 

 

Export all audits: 

http://localhost:9000/v1/jobs/executions/audits.csv 

 

Export all audits for job X: 

http://localhost:9000/v1/jobs/X/executions/audits.csv 

 

Export all audits for job X, execution ID of Y: 

http://localhost:9000/v1/jobs/X/executions/Y/audits.csv 

 

To query failures, use the previous three queries, substituting "failures.csv" for "audits.csv".

For example, to export all failures for job X, execution ID of Y: 

http://localhost:9000/v1/jobs/X/executions/Y/failures.csv