Table of Contents

Query the change log

The sample demonstrates how to query the adTempus Change Log (audit log) to report on tracked changes to adTempus configuration.

Note that auditing must be configured properly for adTempus.

using (var session = Scheduler.Connect(ServerName, LoginAuthenticationType.Windows, "", ""))
{
    var parms=new ChangeLogQueryParameters();
    parms.ExcludeSystemGenerated=true;	//don't include changes made by the system, e.g., jobs held by job control action
    parms.IncludeObjectDescriptions=true;	//resolve the objects and populate the ObjectDescription field. Otherwise it will be empty.
    parms.AuditOnly=true;	//exclude records that were just snapshots
    
    //query the last 7 days of changes
    parms.EndTimestamp=DateTime.Now;
    parms.StartTimestamp=parms.EndTimestamp.Value.Subtract(TimeSpan.FromDays(7));

    var records = session.QueryChangeLog(parms);
    foreach (var record in records)
    {
        Console.WriteLine($"{record.Timestamp:yyyy-MM-dd HH:mm:ss}. Action: {record.ChangeType}. Object: {record.ObjectDescription}. User: {record.SecurityLogin.Name}");
    }
}