Cleaning up UDI and DE search data

Data Explorer searches produce data, which is deleted after a set period. If the Data Explorer search data exceeds the resource allocation for the PostgreSQL database, Data Explorer and other pods in the cluster can go into a failure state and new searches fail. The dequery_maintenance action helps to address this issue.

Before you begin

To access the dequery_maintenance action, you must install the command-line interface (CLI) utility cpctl from the cp-serviceability pod. For more information, see Installing the cpctl utility.

About this task

The dequery_maintenance script removes Data Explorer PostgreSQL search data that is older than the number of days that you specify. If you specify 0 days, all search data is deleted.

Procedure

  1. Find out whether the issue is in Data Explorer by typing the following commands.
    cpctl diagnostics check_deployment --only udi
    cpctl diagnostics check_deployment --only de
    The outputs of these commands show the current operating status of some of the underlying dependencies of Data Explorer.

    If the output of the lines that follow Check PostgreSQL for UDI... or Query Postgres... indicate any errors, then you might be in this state with the PostgreSQL database.

  2. Run the dequery_maintenance action to remove search data older than <interval> in days.
    cpctl remediation dequery_maintenance --interval <days> --token $(oc whoami -t)

Results

The following output is an example of the result of running the command
cpctl remediation dequery_maintenance --interval 10
Executing playbook dequery_maintenance.yaml

- localhost on hosts: localhost -
Gathering Facts...
  localhost ok
Cleanup PG Data...
  localhost done | stdout: [INFO] 2021-09-21T21:08:36 collect pg info
        delete_expired_queries        
--------------------------------------
 728b3fc3-5a6a-4eb7-8efb-ac8d521341b4
(1 row)