Rechercher

Ce contenu n'est pas disponible dans la langue sélectionnée.

Chapter 30. Managing log data

download PDF

Red Hat Process Automation Manager manages the required maintenance runtime data. It removes some data automatically, including the following data types:

  • Process instance data, which is removed upon process instance completion.
  • Work item data, which is removed upon work item completion.
  • Task instance data, which is removed upon completion of a process to which the given task belongs.

Runtime data that is not cleaned automatically includes session information data that is based on the selected runtime strategy.

  • Singleton strategy ensures that runtime data of session information is not automatically removed.
  • Per request strategy allows automatic removal when a request is terminated.
  • Per process instances automatically removes process instance data when a process instance is mapped to a session that is completed or aborted.

Red Hat Process Automation Manager also provides audit log data tables. You can use these tables to keep track of current and past process instances. By default, Red Hat Process Automation Manager does not remove any data from audit log tables.

There are three ways to manage and maintain the audit data tables:

30.1. Setting up automatic cleanup job

You can set up an automatic cleanup job in Business Central.

Procedure

  1. In Business Central, go to Manage > Jobs.
  2. Click New Job.
  3. Enter values for Business Key, Due On, and Retries fields.
  4. Enter the following command into the Type field.

    org.jbpm.executor.commands.LogCleanupCommand
  5. To configure parameters, complete the following steps:

    1. Click the Advanced tab.
    2. Click Add Parameter.
    3. In the Key column, enter a parameter.
    4. In the Value column, enter a parameter.

    For the list of parameters for the command, see Section 30.3, “Removing logs from the database”.

  6. Click Create.

Business Central creates the automatic cleanup job.

30.2. Manual cleanup

To perform manual cleanup, you can use the audit Java API. The audit API consists of the following areas:

Table 30.1. Audit API areas
NameDescription

Process audit

It is used to clean up process, node and variable logs that are accessible in the jbpm-audit module.

For example, you can access the module as follows: org.jbpm.process.audit.JPAAuditLogService

Task audit

It is used to clean up tasks and events that are accessible in the jbpm-human-task-audit module.

For example, you can access the module as follows: org.jbpm.services.task.audit.service.TaskJPAAuditService

Executor jobs

It is used to clean up executor jobs and errors that are accessible in the jbpm-executor module.

For example, you can access the module as follows: org.jbpm.executor.impl.jpa.ExecutorJPAAuditService

30.3. Removing logs from the database

Use LogCleanupCommand executor command to clean up the data, which is using the database space. The LogCleanupCommand consists of logic to automatically clean up all or selected data.

There are several configuration options that you can use with the LogCleanupCommand:

Table 30.2. LogCleanupCommand parameters table
NameDescriptionIs Exclusive

SkipProcessLog

Indicates whether process and node instances, and process variables log cleanup is skipped when the command runs. The default value is false.

No, it is used with other parameters.

SkipTaskLog

Indicates if the task audit and event log cleanup are skipped. The default value is false.

No, it is used with other parameters.

SkipExecutorLog

Indicates if Red Hat Process Automation Manager executor entries cleanup is skipped. The default value is false.

No, it is used with other parameters.

SingleRun

Indicates if a job routine runs only once. The default value is false.

No, it is used with other parameters.

NextRun

Schedules the next job execution. The default value is 24h.

For example, set to 12h for jobs to be executed every 12 hours. The schedule is ignored if you set SingleRun to true, unless you set both SingleRun and NextRun. If both are set, the NextRun schedule takes priority. The ISO format can be used to set the precise date.

No, it is used with other parameters.

OlderThan

Logs that are older than the specified date are removed. The date format is YYYY-MM-DD. Usually, this parameter is used for single run jobs.

Yes, it is not used with OlderThanPeriod parameter.

OlderThanPeriod

Logs that are older than the specified timer expression are removed. For example, set 30d to remove logs, which are older than 30 days.

Yes, it is not used with OlderThan parameter.

ForProcess

Specifies process definition ID for logs that are removed.

No, it is used with other parameters.

RecordsPerTransaction

Indicates the number of records in a transaction that is removed. The default value is 0, indicating all the records.

No, it is used with other parameters.

ForDeployment

Specifies deployment ID of the logs that are removed.

No, it is used with other parameters.

EmfName

Persistence unit name that is used to perform delete operation.

Not applicable

Note

LogCleanupCommand does not remove any active instances, such as running process instances, task instances, or executor jobs.

30.4. Running a custom query on the Red Hat Process Automation Manager database

You can use the ExecuteSQLQueryCommand executor command to run a custom query on the Red Hat Process Automation Manager database, including the audit log data tables. You can set up a job that runs this command in Business Central.

Procedure

  1. In Business Central, select Manage > Jobs.
  2. Click New Job.
  3. Enter values for Business Key, Due On, and Retries fields.
  4. Enter the following command into the Type field.

    org.jbpm.executor.commands.ExecuteSQLQueryCommand
  5. To configure parameters, complete the following steps:

    1. Open the Advanced tab.
    2. Click Add Parameter.
    3. In the Key column, enter a parameter value.
    4. In the Value column, enter a parameter value.

    For the list of parameters for the command, see Section 30.4.1, “Parameters for the ExecuteSQLQueryCommand command”.

  6. Click Create. Business Central creates the custom query job.
  7. Optional: If you want to retrieve the results of the query, complete the following steps:

    1. In the list of jobs that Business Central displays, find the job that you started. If the job is not present in the list, remove any filters from the Active filters list.
    2. Record the id value for the job.
    3. Using a web browser, access the Swagger documentation on your KIE Server at <kie_server_address>/docs, for example, http://localhost:8080/kie-server/docs/.
    4. Click the GET /server/jobs/{jobId} request.
    5. In the jobId field, enter the id value that you recorded.
    6. From the withErrors list, select true.
    7. From the withData list, select true.
    8. Click Execute.
    9. Review the Server response field. If the SQL query succeeded, the result is under the "response-data" key.

30.4.1. Parameters for the ExecuteSQLQueryCommand command

The ExecuteSQLQueryCommand executor command runs a custom query on the Red Hat Process Automation Manager database, including the audit log tables. For the schema for the audit log tables, see Process engine in Red Hat Process Automation Manager.

You can configure the following parameters for the ExecuteSQLQueryCommand command.

Table 30.3. ExecuteSQLQueryCommand parameters table
NameDescription

SingleRun

true if the query can be triggered once. false if the query can be triggered multiple times.

EmfName

name of the persistence unit to be used to run the query

businessKey

The business key to use with the query. If configuring the command in Business Central, use the business key that you set for the job

SQL

The native SQL query to execute. Preface parameters with the : character

parametersList

List of all parameters in the SQL query. Separate the parameters with the , character

SQL parameter name

The value for the SQL parameter. Create a separate command parameter for every SQL parameter

For example, you might use a query with two parameters:

SELECT * FROM RequestInfo WHERE id = :paramId AND businessKey = :paramKey

Set the following parameters for the ExecuteSQLQueryCommand command:

  • SQL: SELECT * FROM RequestInfo WHERE id = :paramId AND businessKey = :paramKey ;
  • parametersList: paramId,paramKey
  • paramId: The value for id
  • paramKey: The value for businessKey
Red Hat logoGithubRedditYoutubeTwitter

Apprendre

Essayez, achetez et vendez

Communautés

À propos de la documentation Red Hat

Nous aidons les utilisateurs de Red Hat à innover et à atteindre leurs objectifs grâce à nos produits et services avec un contenu auquel ils peuvent faire confiance.

Rendre l’open source plus inclusif

Red Hat s'engage à remplacer le langage problématique dans notre code, notre documentation et nos propriétés Web. Pour plus de détails, consultez leBlog Red Hat.

À propos de Red Hat

Nous proposons des solutions renforcées qui facilitent le travail des entreprises sur plusieurs plates-formes et environnements, du centre de données central à la périphérie du réseau.

© 2024 Red Hat, Inc.