[
  {
    "query-name" : "first-query",
    "query-source" : "${org.kie.server.persistence.ds}",
    "query-expression" : "select * from ProcessInstanceLog",
    "query-target" : "PROCESS"

  },
  {
    "query-name" : "second-query",
    "query-source" : "${org.kie.server.persistence.ds}",
    "query-expression" : "select * from NodeInstanceLog",
    "query-target" : "CUSTOM"

  },
  {
    "query-name": "jbpmProcessInstances",
    "query-source": "${org.kie.server.persistence.ds}",
    "query-expression": "select log.processInstanceId, log.processId, log.start_date, log.end_date, log.status, log.parentProcessInstanceId, log.outcome, log.duration, log.user_identity, log.processVersion, log.processName, log.correlationKey, log.externalId, log.processInstanceDescription, log.sla_due_date, log.slaCompliance, COALESCE(info.lastModificationDate, log.end_date) as lastModificationDate, (select COUNT(errInfo.id) from ExecutionErrorInfo errInfo where errInfo.PROCESS_INST_ID=log.processInstanceId and errInfo.ERROR_ACK=0) as errorCount from ProcessInstanceLog log left join ProcessInstanceInfo info on info.InstanceId=log.processInstanceId",
    "query-target": "CUSTOM"
  },
  {
    "query-name": "jbpmHumanTasksWithAdmin",
    "query-source": "${org.kie.server.persistence.ds}",
    "query-expression": "select t.activationTime, t.actualOwner, t.createdBy, t.createdOn, t.deploymentId, t.description, t.dueDate, t.name, t.parentId, t.priority, t.processId, t.processInstanceId, t.processSessionId, t.status, t.taskId, t.workItemId, t.lastModificationDate, pil.correlationKey, pil.processInstanceDescription ,oe.id, nil.sla_due_date, nil.slaCompliance, (select COUNT(errInfo.id) from ExecutionErrorInfo errInfo where errInfo.ACTIVITY_ID = t.taskId and errInfo.PROCESS_INST_ID = pil.processInstanceId and errInfo.ERROR_ACK = 0 and errInfo.ERROR_TYPE = 'Task') as errorCount from AuditTaskImpl t  left join ProcessInstanceLog pil on pil.processInstanceId = t.processInstanceId left join PeopleAssignments_BAs ba on t.taskId = ba.task_id left join OrganizationalEntity oe on ba.entity_id = oe.id left join NodeInstanceLog nil on nil.workItemId=t.workItemId",
    "query-target": "FILTERED_BA_TASK"
  }
]