Starting with Winter’16 the SetupAuditTrail object is exposed to query from Apex.
For fields in the object, check the below link
Sample SOQL:
List<SetupAuditTrail> listAudits = [SELECT Id,
Action,
CreatedBy.Name,
CreatedDate,
Display,
Section
FROM SetupAuditTrail
WHERE CreatedBy.Email LIKE ‘%abc.com%’];
SOQL on SetupAuditTrail is not returning Login As Information.
When I am using impersonate (log in as) then it is creating a record in SetupAuditTrail but it is not coming as a result in SOQL.
DelegateUser column in SetupAuditTrail is the user who executed the action in Setup. If a Login-As user didn’t perform the action, this field is blank. This field is available in API version 35.0 and later.