Learn R Programming

redcapAPI (version 2.10.0)

exportLogging: Export Logging Records

Description

These methods enable to user to export the logging (audit trail) of all changes made to a project, including data exports, data changes, project metadata changes, modification of user rights, etc.

Usage

exportLogging(
  rcon,
  logtype = character(0),
  user = character(0),
  record = character(0),
  dag = character(0),
  beginTime = as.POSIXct(character(0)),
  endTime = as.POSIXct(character(0)),
  batchInterval = NULL,
  ...
)

# S3 method for redcapApiConnection exportLogging( rcon, logtype = character(0), user = character(0), record = character(0), dag = character(0), beginTime = as.POSIXct(character(0)), endTime = as.POSIXct(character(0)), batchInterval = NULL, ... )

Value

Returns a data frame with columns

timestampThe date/time of the logging record.
usernameThe user name of the user that performed the action being logged.
actionThe classification of action being logged.
detailsDetails of the action being logged.
recordThe record ID associated with the action being logged. When not related to a record, this will be NA

Arguments

rcon

A redcapConnection object.

logtype

character(0/1). The log event types to export. When the length is zero, all event types are exported. Otherwise, it must be one of c("export", "manage", "user", "record", "record_add", "record_edit", "record_delete", "lock_record", "page_view")

user

character(0/1). Users for whom to return logs. By default logs for all users are returned.

record

character(0/1). Record ID for which logs are to be returned. By default, logs are returned for all records.

dag

character(0/1). Data access group ID for which to return logs. By default, logs are returned for all data access groups.

beginTime

POSIXct(0/1). When given, only logs recorded on or after this time will be returned. The time specified is rounded to minutes and ignores the timezone. This can cause issues if the caller and server computers are configured in different timezones. Least surprising behavior is making sure the date specified is encoded in the timezone of the REDCap server.

endTime

POSIXct(0/1). When given, only logs recorded on or before this time will be returned. If using batchInterval it will only be before this time. See beginTime for details on time encoding.

batchInterval

integerish(1). When provided will batch log pulls to intervals of this many days. Requires that beginTime is specified.

...

Arguments to pass to other methods

Examples

Run this code
if (FALSE) {
unlockREDCap(connections = c(rcon = "project_alias"), 
             url = "your_redcap_url", 
             keyring = "API_KEYs", 
             envir = globalenv())
                    
# Export all of the logging events       
exportLogging(rcon)
  
# Export all of the events for record '2'
exportLogging(rcon, 
              record = "2")
                
# Export all of the events where a record was deleted
exportLoging(rcon, 
             logtype = "record_delete")
}

Run the code above in your browser using DataLab