10.2. Audit Log

In many cases it will be useful (if not necessary) to store information about the execution of process instances, so that this information can be used afterwards. For example, sometimes we want to verify which actions have been executed for a particular process instance, or in general, we want to be able to monitor and analyze the efficiency of a particular process.

However, storing history information in the runtime database can result in the database rapidly increasing in size, not to mention the fact that monitoring and analysis queries might influence the performance of your runtime engine. This is why process execution history information can be stored separately.

This history log of execution information is created based on events that the jBPM engine generates during execution. This is possible because the jBPM runtime engine provides a generic mechanism to listen to events. The necessary information can easily be extracted from these events and then persisted to a database. Filters can also be used to limit the scope of the logged information.
10.2.1. The jBPM Audit data model

The jbpm-audit module contains an event listener that stores process-related information in a database using JPA. The data model itself contains three entities, one for process instance information, one for node instance information, and one for (process) variable instance information.

The ProcessInstanceLog table contains the basic log information about a process instance.
Table 18. ProcessInstanceLog Field Description Nullable

id

The primary key and id of the log entity

NOT NULL

duration

Actual duration of this process instance since its start date

end_date

When applicable, the end date of the process instance

externalId

Optional external identifier used to correlate to some elements - e.g. deployment id

user_identity

Optional identifier of the user who started the process instance

outcome

The outcome of the process instance, for instance error code in case of process instance was finished with error event

parentProcessInstanceId

The process instance id of the parent process instance if any

processid

The id of the process

processinstanceid

The process instance id

NOT NULL

processname

The name of the process

processversion

The version of the process

start_date

The start date of the process instance

status

The status of process instance that maps to process instance state

The NodeInstanceLog table contains more information about which nodes were actually executed inside each process instance. Whenever a node instance is entered from one of its incoming connections or is exited through one of its outgoing connections, that information is stored in this table.
Table 19. NodeInstanceLog Field Description Nullable

id

The primary key and id of the log entity

NOT NULL

connection

Actual identifier of the sequence flow that led to this node instance

log_date

The date of the event

externalId

Optional external identifier used to correlate to some elements - e.g. deployment id

nodeid

The node id of the corresponding node in the process definition

nodeinstanceid

The node instance id

nodename

The name of the node

nodetype

The type of the node

processid

The id of the process that the process instance is executing

processinstanceid

The process instance id

NOT NULL

type

The type of the event (0 = enter, 1 = exit)

NOT NULL

workItemId

Optional - only for certain node types - The identifier of work item

The VariableInstanceLog table contains information about changes in variable instances. The default is to only generate log entries when (after) a variable changes. It’s also possible to log entries before the variable (value) changes.
Table 20. VariableInstanceLog Field Description Nullable

id

The primary key and id of the log entity

NOT NULL

externalId

Optional external identifier used to correlate to some elements - e.g. deployment id

log_date

The date of the event

processid

The id of the process that the process instance is executing

processinstanceid

The process instance id

NOT NULL

oldvalue

The previous value of the variable at the time that the log is made

value

The value of the variable at the time that the log is made

variableid

The variable id in the process definition

variableinstanceid

The id of the variable instance

The AuditTaskImpl table contains information about tasks that can be used for queries.
Table 21. AuditTaskImpl Field Description Nullable

id

The primary key and id of the task log entity

activationTime

Time when this task was activated

actualOwner

Actual owner assigned to this task - only set when task is claimed

createdBy

User who created this task

createdOn

Date when task was created

deploymentId

Deployment id this task is part of

description

Description of the task

dueDate

Due date set on this task

name

Name of the task

parentId

Parent task id

priority

Priority of the task

processId

Process definition id that this task belongs to

processInstanceId

Process instance id that this task is associated with

processSessionId

KieSession id used to create this task

status

Current status of the task

taskId

Identifier of task

workItemId

Identifier of work item assigned on process side to this task id

The BAMTaskSummary table that collects information about tasks that is used by BAM engine to build charts and dashboards.
Table 22. BAMTaskSummary Field Description Nullable

id

The primary key and id of the log entity

NOT NULL

createdDate

Date when task was created

duration

Duration since task was created

endDate

Date when task reached end state (complete, exit, fail, skip)

processinstanceid

The process instance id

startDate

Date when task was started

status

Current status of the task

taskId

Identifier of the task

taskName

Name of the task

userId

User id assigned to the task

The TaskVariableImpl table contains information about task variable instances.
Table 23. TaskVariableImpl Field Description Nullable

id

The primary key and id of the log entity

NOT NULL

modificationDate

Date when the variable was modified last time

name

Name of the task

processid

The id of the process that the process instance is executing

processinstanceid

The process instance id

taskId

Identifier of the task

type

Type of the variable - either input or output of the task

value

Variable value

The TaskEvent table contains information about changes in task instances. Operations such as claim, start, stop etc are stored here to provide time line view of events that happened to given task.
Table 24. TaskEvent Field Description Nullable

id

The primary key and id of the log entity

NOT NULL

logTime

LDate when this event was saved

message

Log event message

processinstanceid

The process instance id

taskId

Identifier of the task

type

Type of the event - corresponds to life cycle phases of the task

userId

User id assigned to the task

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值