queryAuditLog

Description

Query the audit log of a database

Usage

queryAuditLog(
  databaseId,
  before = Sys.time(),
  after = NULL,
  resourceId = NULL,
  typeFilter = NULL
)

Arguments

ArgumentDescription
databaseIdthe database identifier.
beforea Date , POSIX , or (UNIX) timestamp (in milliseconds) to filter result before a given time; defaults to the time of the query.
afteran optional Date , POSIX or numeric value representing a UNIX timestamp (in milliseconds).
typeFiltera character string with the event type to filter on; default is none.
resoureIda resource (i.e. form or folder) identifier to filter on.

Details

A database audit log contains details on a wide variety of events in the database. These events include the deletion of records or adding a user. This function queries the audit log and returns the event details as a data frame. Note that each query returns a maximum of 100 events, therefore the data frame has three attributes to help you query older log entries:

  • databaseId : the database identifier;

  • moreEvents : if TRUE then there are more (older) entries to be queried;

  • startTime : the (UNIX) timestamp which is essentially the same as the time provided in the before argument of the query;

  • endTime the earliest timestamp of the range, which can be used to query the next set of entries.

Value

A data frame with the results of the query and with three attributes as described in the Details section.

Examples

# keep querying the audit log until no more events are found:
events <- queryAuditLog("asjdhewhasd", typeFilter = "RECORD")
r <- events
while (isTRUE(attr(r, "moreEvents"))) {
  r <- queryAuditLog("asjdhewhasd", before = attr(r, "endTime"), typeFilter = "RECORD")
  events <- rbind(events, r)
}