Full log (event stream) over the Rest API

Hello,

I cannot find the “full log” as described in
https://docs.camunda.org/manual/7.8/user-guide/process-engine/history/
in the REST API. (/history/detail seems not to give me any transitions between activities)
I would like to get the full event stream.

Best

Clemens

Hi Clemens,
Have you set the history level to ‘Full’ or something to other than ‘None’? Have you provided at least one query parameter in the REST api call?

Joe

Hi @ClemensTan - The full audit is spread across variable “hi” tables and “hi resp api” . if you are interested to know the process instance history you can try to join ACT_HI_ACTINST and ACT_HI_OP_LOG . These 2 tables provide most of the Process history like task claim / unclaim / process suspend / boundary timers etc . Once this is working as expected you can write a native query of use ibatis and expose it as Custom Rest Api .

Thanks
Dinesh

Hi Dinesh,
thank you for the explanation. I am very new to Camunda. I am using it as a black box (running as docker container) and try to access all data just over the provided REST API. I was wondering, if I can get all insights of a running or finished process over the existing REST API. So, to a complete event stream, I need to read the data directly from the history database?

Thanks
Clemens

Hi Joe, I think I miss understood the meaning of the /history/detail endpoint. I was looking for an end point, which gives me a full chronological list, of everything happend during a process. I would like to fetch the full “event stream” over the REST API.

Hi @ClemensTan - To my knowledge the API which will give most of the information is https://docs.camunda.org/manual/latest/reference/rest/history/activity-instance/get-activity-instance-query/ . Note this API may not return the events like Process Suspended/Resumed / Reassigning the task etc .

Thanks
Dinesh

Hi Dinesh,
thanks for the hint. So it seems, that I have to combine the results different REST calls to re-construct a full event stream. I guess, I should get familiar with the Java API or access the database directly.

Thanks
Clemens

Hi @ClemensTan,

it’s interesting to get the use case for your full log.

What do want to do with it once you have it?

I’m asking, because most people find all important information in the histoy view of Cockpit (https://docs.camunda.org/manual/7.12/webapps/cockpit/bpmn/process-history-views/), and here distributed in several tabs, to make it accessible for a human being.

Optimize can do it as well, more focued on flexible reporting.

What is your use case?

Cheers, Ingo

Hi Ingo,

in our use case, we need to collect as much runtime information as possible to be able to create reports automatically . We need any information we can collect (which path in the process has been chosen, which variables have been written to, what messages and events occurred).
We need a chronological combined log of “everything” to fulfill regulatory documentation requirements.

Best
Clemens

Hi @ClemensTan,

the most easy way to create these reports will be to query the database for historic data.

Cheers, Ingo

Hi Ingo,
thanks for the reply.
Then, I will do it directly by accessing the database.

Best
Clemens

Hi @ClemensTan – Please see if the below query helps you .

// create a query against the ACT_HI_ACTHISTORY table and ACT_HI_OP_LOG table but TRANSFORM IT AS A “** TASK HISTORY(ACT_HI_TASKINST) INSTANCE **”

	StringBuilder sb = new StringBuilder();
	sb.append("SELECT ID_,TASK_ID_ AS TASK_DEF_KEY_, COALESCE(ASSIGNEE_,'SYSTEM') AS ASSIGNEE_ , START_TIME_, ACT_NAME_ AS NAME_ , ACT_TYPE_ AS ACT_INST_ID_,'' AS OWNER_ , '' AS DESCRIPTION_ , ");
	sb.append("(SELECT START_USER_ID_ 	FROM ACT_HI_PROCINST WHERE PROC_INST_ID_=#{processInstanceId} ) AS TENANT_ID_ ");
	sb.append(" FROM ACT_HI_ACTINST WHERE PROC_INST_ID_=#{processInstanceId} ");
	sb.append(" UNION ALL");
	sb.append(" SELECT ID_,TASK_ID_ AS TASK_DEF_KEY_, USER_ID_ AS ASSIGNEE_ ,TIMESTAMP_ AS START_TIME_, OPERATION_TYPE_ AS NAME_ , ENTITY_TYPE_ AS ACT_INST_ID_,ORG_VALUE_ AS OWNER_ ,NEW_VALUE_ AS DESCRIPTION_ , '' AS TENANT_ID_\r\n" + 
			"");
	sb.append(" FROM ACT_HI_OP_LOG WHERE PROC_INST_ID_=#{processInstanceId}");
	sb.append(" ORDER BY START_TIME_ ASC ");
	
	List<HistoricTaskInstance> nativeActInstList = historyService.createNativeHistoricTaskInstanceQuery().
			sql(sb.toString()).parameter("processInstanceId", processInstanceId).list();