User operation log
The user operation log contains entries for many API operations and can be used for auditing purposes. It provides data on what kind of operations are performed as well as details on the changes involved in the operation. Operations are logged when the operation is performed in the context of a logged in user. To use the operation log, the process engine history level must be set to FULL
.
Write log entries regardless of user authentication context
If it is desired that operations are logged regardless whether they are performed in the context of a logged in user or not, then the process engine configuration flag named restrictUserOperationLogToAuthenticatedUsers
can be set to false
.
Access the user operation log
The user operation log can be accessed via the Java API. The history service can be used to execute a UserOperationLogQuery
by calling historyService.createUserOperationLogQuery().execute()
. The query can be restricted with various filtering options. The query is also exposed in the REST API.
User operation log entries
The log consists of operations and entries. An operation corresponds to one performed action and consists of multiple entries, at least one. Entries contain the detailed changes being part of the operation. When making a user operation log query, the returned entities are of type UserOperationLogEntry
, corresponding to entries. All entries of one operation are linked by an operation id.
A user operation log entry has the following properties:
- Operation ID: A generated id that uniquely identifies a performed operation. Multiple log entries that are part of one operation reference the same operation ID.
- Operation Type: The name of the performed operation. Available operation types are listed in the interface org.camunda.bpm.engine.history.UserOperationLogEntry . Note that one operation can consist of multiple types, for example a cascading API operation is one user operation, but is split into multiple types of operations.
- Entity Type: An identifier of the type of the entity that was addressed by the operation. Available entity types are listed in the class org.camunda.bpm.engine.EntityTypes . Like the operation type, one operation may address more than one type of entity.
- Category: The name of the category the operation is associated with. Available categories are listed in the interface org.camunda.bpm.engine.history.UserOperationLogEntry . For example, all task related runtime operations like claiming and completing tasks fall into the category TaskWorker .
- Annotation: An arbitrary text annotation set by a user for auditing reasons. Multiple log entries that belong to an operation have the same annotation.
- Entity IDs: A job log entry contains the entity IDs that serve to identify the entities addressed by the operation. For example, an operation log entry on a task contains the id of the task as well as the id of the process instance the task belongs to. As a second example, a log entry for suspending all process instances of a process definition does not contain individual process instance IDs but only the process definition ID.
- User ID: The ID of the user who performed the operation.
- Timestamp: The time at which the operation was performed.
- Changed Property: A user operation may change multiple properties. For example, suspension of a process instance changes the suspension state property. A log entry is created for each changed property involved in an operation.
- Old Property Value: The previous value of the changed property. A
null
value either indicates that the property was previouslynull
or is not known. - New Property Value: The new value of the changed property.
Annotation of user operation logs
User Operation Logs are helpful to audit manual operations. To make it obvious why a certain operation was performed, sometimes it is not enough to only log technical information (e. g. timestamp, operation type, etc.) but also add an annotation that puts the operation in the right business context.
You can directly pass an annotation for the following operations:
You can also set an annotation to an operation log which is already present:
An annotation can be set and cleared via Java API:
String operationId = historyService.createUserOperationLogQuery()
.singleResult()
.getOperationId();
String annotation = "Instances restarted due to wrong turn";
historyService.setAnnotationForOperationLogById(operationId, annotation);
historyService.clearAnnotationForOperationLogById(operationId);
Please note: Annotations are present on all entries that belong to an operation log.
Please also see the REST API reference for setting and clearing annotations.
Glossary of operations logged in the user operation log
The following describes the operations logged in the user operation log and the entries that are created as part of it:
Entity Type | Operation Type | Category | Properties |
---|---|---|---|
Task | Assign | TaskWorker |
|
Claim | TaskWorker |
|
|
Complete | TaskWorker |
|
|
Create | TaskWorker | No additional property is logged | |
Delegate | TaskWorker |
When delegating a task, three log entries are created, containing one of the following properties:
|
|
Delete | TaskWorker |
|
|
Resolve | TaskWorker |
|
|
SetOwner | TaskWorker |
|
|
SetPriority | TaskWorker |
|
|
Update | TaskWorker |
The manually changed property of a task, where manually means that a property got directly changed. Claiming a task via the TaskService wouldn't be logged with an update entry, but setting the assignee directly would be. One of the following is possible:
|
|
DeleteHistory | Operator |
|
|
ProcessInstance | Create | Operator | No additional property is logged |
Activate | Operator |
|
|
Delete | Operator |
In case of regular operation:
|
|
ModifyProcessInstance | Operator |
|
|
Suspend | Operator |
|
|
Migrate | Operator |
|
|
RestartProcessInstance | Operator |
|
|
DeleteHistory | Operator |
|
|
CreateIncident | Operator |
|
|
Resolve | Operator |
|
|
SetRemovalTime | Operator |
|
|
SetVariables | Operator |
|
|
CorrelateMessage | Operator |
|
|
Incident | SetAnnotation | Operator |
|
ClearAnnotation | Operator |
|
|
IdentityLink | AddUserLink | TaskWorker |
|
DeleteUserLink | TaskWorker |
|
|
AddGroupLink | TaskWorker |
|
|
DeleteGroupLink | TaskWorker |
|
|
Attachment | AddAttachment | TaskWorker |
|
DeleteAttachment | TaskWorker |
|
|
JobDefinition | ActivateJobDefinition | Operator |
|
SetPriority | Operator |
|
|
SuspendJobDefinition | Operator |
|
|
ProcessDefinition | ActivateProcessDefinition | Operator |
|
SuspendProcessDefinition | Operator |
|
|
Delete | Operator |
|
|
UpdateHistoryTimeToLive | Operator |
|
|
DecisionDefinition | UpdateHistoryTimeToLive | Operator |
|
Evaluate | Operator |
|
|
CaseDefinition | UpdateHistoryTimeToLive | Operator |
|
Job | ActivateJob | Operator |
|
SetPriority | Operator |
|
|
SetJobRetries | Operator |
|
|
SuspendJob | Operator |
|
|
Execute | Operator | No additional property is logged | |
Delete | Operator | No additional property is logged | |
SetDueDate | Operator |
|
|
RecalculateDueDate | Operator |
|
|
CreateHistoryCleanupJobs | Operator |
|
|
Variable | ModifyVariable | Operator/ TaskWorker |
No additional property is logged |
RemoveVariable | Operator/ TaskWorker |
No additional property is logged | |
SetVariable | Operator/ TaskWorker |
No additional property is logged | |
DeleteHistory | Operator |
In case of single operation:
|
|
Deployment | Create | Operator |
|
Delete | Operator |
|
|
Batch | ActivateBatch | Operator |
|
SuspendBatch | Operator |
|
|
Delete | Operator |
|
|
DeleteHistory | Operator | No additional property is logged | |
SetRemovalTime | Operator |
|
|
ExternalTask | SetExternalTaskRetries | Operator |
|
SetPriority | Operator |
|
|
Unlock | Operator | No additional property is logged | |
DecisionInstance | DeleteHistory | Operator |
|
SetRemovalTime | Operator |
|
|
CaseInstance | DeleteHistory | Operator |
|
Metrics | Delete | Operator |
|
TaskMetrics | Delete | Operator |
|
OperationLog | SetAnnotation | Operator |
|
ClearAnnotation | Operator |
|
|
Filter | Create | TaskWorker |
|
Update | TaskWorker |
|
|
Delete | TaskWorker |
|
|
Comment | Update | TaskWorker |
|
Delete | TaskWorker |
|
|
User | Create | Admin |
|
Update | Admin |
|
|
Delete | Admin |
|
|
Unlock | Admin |
|
|
Group | Create | Admin |
|
Update | Admin |
|
|
Delete | Admin |
|
|
Tenant | Create | Admin |
|
Update | Admin |
|
|
Delete | Admin |
|
|
Group membership | Create | Admin |
|
Delete | Admin |
|
|
TenantMembership | Create | Admin |
|
Delete | Admin |
|
|
Authorization | Create | Admin |
|
Update | Admin |
|
|
Delete | Admin |
|
|
Property | Create | Admin |
|
Update | Admin |
|
|
Delete | Admin |
|