API audit - RapturePlatform/Rapture GitHub Wiki

Audit API

The Audit API provides a way to create special logs that contain permanent records of activity in a Rapture system. Internally Rapture uses a system audit log for recording important events that take place in a Rapture environment. Users (or applications) can create their own custom audit logs for the same purpose.

The API provides a way of creating and removing these logs, along with a simple way of recording log entries. A final API call gives the caller the ability to retrieve log entries.

setup

HttpAuditApi auditApi = new HttpAuditApi(loginApi);
void retVal = auditApi.setup(force);
retVal = baseAPI.doAudit_Setup(force);

Entitlement: /audit/admin

Sets up anything needed for audit to run properly. This should be called from the _startup.rfx script. This call is used internally by Rapture on startup, and is normally called only for debugging purposes.

Function Parameters

Parameter Type Description
force boolean

Return value

Type Description
void

createAuditLog

HttpAuditApi auditApi = new HttpAuditApi(loginApi);
void retVal = auditApi.createAuditLog(name, config);
retVal = baseAPI.doAudit_CreateAuditLog(name, config);

Entitlement: /audit/admin

This method creates a new audit log, given a name and a config string. The config string defines the implementation to be used to store the audit entries.

Function Parameters

Parameter Type Description
name String
config String

Return value

Type Description
void

doesAuditLogExist

HttpAuditApi auditApi = new HttpAuditApi(loginApi);
boolean retVal = auditApi.doesAuditLogExist(logURI);
retVal = baseAPI.doAudit_DoesAuditLogExist(logURI);

Entitlement: /audit/main

This method checks whether an audit log exists at the specified URI. The log must have been created using createAuditLog.

Function Parameters

Parameter Type Description
logURI String

Return value

Type Description
boolean

getChildren

HttpAuditApi auditApi = new HttpAuditApi(loginApi);
List<RaptureFolderInfo> retVal = auditApi.getChildren(prefix);
retVal = baseAPI.doAudit_GetChildren(prefix);

Entitlement: /audit/main

This method searches for audit logs whose name follows the pattern prefix/anything_else/under/here, where prefix is the argument that is passed in.

Function Parameters

Parameter Type Description
prefix String

Return value

Type Description
List

deleteAuditLog

HttpAuditApi auditApi = new HttpAuditApi(loginApi);
void retVal = auditApi.deleteAuditLog(logURI);
retVal = baseAPI.doAudit_DeleteAuditLog(logURI);

Entitlement: /audit/admin

This method removes a previously created audit log.

Function Parameters

Parameter Type Description
logURI String

Return value

Type Description
void

getAuditLog

HttpAuditApi auditApi = new HttpAuditApi(loginApi);
AuditLogConfig retVal = auditApi.getAuditLog(logURI);
retVal = baseAPI.doAudit_GetAuditLog(logURI);

Entitlement: /audit/admin

This method retrieves the config information for a previously created audit log.

Function Parameters

Parameter Type Description
logURI String

Return value

Type Description
AuditLogConfig
Types used in this function

AuditLogConfig

Stores the config information for an audit log.

Field Type
name String
config String

writeAuditEntry

HttpAuditApi auditApi = new HttpAuditApi(loginApi);
void retVal = auditApi.writeAuditEntry(logURI, category, level, message);
retVal = baseAPI.doAudit_WriteAuditEntry(logURI, category, level, message);

Entitlement: /audit/admin

This method writes an audit entry to the audit log specified by the URI parameter.

Function Parameters

Parameter Type Description
logURI String
category String
level int
message String

Return value

Type Description
void

writeAuditEntryData

HttpAuditApi auditApi = new HttpAuditApi(loginApi);
void retVal = auditApi.writeAuditEntryData(logURI, category, level, message, data);
retVal = baseAPI.doAudit_WriteAuditEntryData(logURI, category, level, message, data);

Entitlement: /audit/admin

This method writes an audit entry to an audit log.

Function Parameters

Parameter Type Description
logURI String
category String
level int
message String
data Map<String,Object>

Return value

Type Description
void

getRecentLogEntries

HttpAuditApi auditApi = new HttpAuditApi(loginApi);
List<AuditLogEntry> retVal = auditApi.getRecentLogEntries(logURI, count);
retVal = baseAPI.doAudit_GetRecentLogEntries(logURI, count);

Entitlement: /audit/admin

This method retrieves previously registered log entries, given a maximum number of entries to return.

Function Parameters

Parameter Type Description
logURI String
count int

Return value

Type Description
List

getEntriesSince

HttpAuditApi auditApi = new HttpAuditApi(loginApi);
List<AuditLogEntry> retVal = auditApi.getEntriesSince(logURI, when);
retVal = baseAPI.doAudit_GetEntriesSince(logURI, when);

Entitlement: /audit/main

This method retrieves any entries since a given entry was retrieved. The date of this audit entry is used to determine the start point of the query.

Function Parameters

Parameter Type Description
logURI String
when AuditLogEntry

Return value

Type Description
List
Types used in this function

AuditLogEntry

Defines an audit result to be logged.

Field Type
category String
entryId String
level int
logId String
message String
source String
user String
when Date
⚠️ **GitHub.com Fallback** ⚠️