6. Report Execution History

The platform provides a mechanism of a report execution history management with the following features:

  1. Save execution history for each report. The system administrator can use the report execution history to find out how often a report is executed, how many seconds of processing time is spent on a report, by which user and when a report was run, what errors occurred during the execution.

  2. Clean outdated report execution history.

The report execution history is disabled by default and can be enabled by setting the reporting.executionHistory.enabled application property to true. You can do it in the Administration > Application Properties screen.

The execution history screen is considered administrative and was not added to the main menu. To view the execution history, go to the reports browser (the Reports>Reports menu item) and click on the Execution history button.

If any report was selected in the Reports table, then the execution history is additionally filtered by the selected report. If no reports were selected in the Reports table, the execution history of all system reports is displayed on the execution history screen.

report execution history
Figure 61. The execution history screen

"Cancelled" flag means that the user launched the report as a background task, and then canceled it.

Execution history is also recorded even for reports which are not yet saved to the database, but launched from the report editor (by clicking the Run button).

Output documents

The mechanism provides an ability to save output documents – report results files – in the file storage. This feature consumes a file storage disk space; it is configured separately and is disabled by default. To enable it, define the reporting.executionHistory.saveOutputDocument application property in the Administration > Application Properties screen:

reporting.executionHistory.saveOutputDocument = true

Now, if you select an item in the execution history table, the Download document button becomes available. Click the button to download a document that is a report result file.

Reports with output types chart, pivot table, and table do not have result files, so the execution history of such reports does not save any output documents.

If you run the report programmatically using the createAndSaveReport() method, it saves another copy of the same result document to the file storage. These two files are put to the file storage independently.

Cleanup the history

You can configure the execution history cleanup procedure to regularly remove unnecessary data.

  • Create and activate a scheduled task. Go to the Administration > Scheduled Tasks screen of your application. Create a new task and set the following parameters:

    • Bean Name = reporting_ExecutionHistoryRecorder

    • Method Name = cleanupHistory()

    • Cron = nightly, e.g. 0 0 1 * * *

    • Singleton – yes (this is important only for a cluster of middleware servers)

      Save the task and click Activate on it.

    If you did not set up the execution of the scheduled tasks for this project before, nothing would happen on this stage – the task will not be executed until you start the whole scheduling mechanism with the cuba.schedulingActive application property.

  • Set up the configuration properties:

    When the report execution history is cleaned up, the associated output document is also deleted from the file storage.