queryAuditLog

Description

Query the audit log of a database

Usage

queryAuditLog(
  databaseId,
  before = Sys.time(),
  after,
  resourceId = NULL,
  typeFilter = NULL,
  limit = 1000,
  verbose = FALSE
)

Arguments

Argument Description
databaseId the database identifier.
before a Date or POSIX to filter result before a given time; defaults to the time of the query.
after an optional Date or POSIX
resourceId a resource (i.e. form or folder) identifier to filter on.
typeFilter a character string with the event type to filter on; default is none.
limit the maximum number of events to return. Default is 1,000 events.
verbose whether to provide the http status codes from requests to the ActivityInfo API, for debugging primarily.

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.

The following event type filters are supported:

  • RECORD : changes to records

  • FORM : changes to form schemas

  • FOLDER : changes to folders

  • DATABASE : changes to the database itself (renaming, creation)

  • LOCK : changes to the database locks

  • USER_PERMISSION : changes to user permissions

  • ROLE : changes to roles

Value

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

Examples

# Query up to 10,000 records
events <- queryAuditLog("cax132253", limit = 10000)

# Query events after the beginning of 2022
events <- queryAuditLog("cax132253", after = as.Date("2022-01-01"))

# Query only changes to user permissions
events <- queryAuditLog("cax132253", typeFilter = "USER_PERMISSION")
Next item
queryReportResults