Purging request data from the BRPM


Data purging is an ongoing maintenance activity that enables you to delete requests and request-related data from the database. You can specify a date and all records on and before the specified date are deleted permanently. 

You can purge request data from the BRPM by using a rake task. 

Important

If you have a large number of requests, which contain a lot of records, data purging activity might take several hours. To save time, schedule the data purging activity on a periodic basis.

On an average, deleting 20000 requests (approximate total number of records: 2400000) takes around 15 minutes. For a large number of records, we recommend that you delete the requests in a phased manner. For example, if you haven't deleted records for the last three years, you can delete records for each year separately to spend less time on the data purging activity.

After purging the request data from the database, the following data is removed from the environment:

  • Request folder, as configured in the automation_setting.rb file is deleted. 
    For example, opt/bmc/RPMHome/automation_results/request folder is deleted.
  • If the steps in the request contain attachments, the uploads folder where the attachments are stored by default is deleted. 
  • To see the results of the data purging rake task, use the following path to open the log file: 
    RPMhome\releases\yourCurrentVersion\RPM\portal.war\WEB-INF\log\purge_data_requests_with_dependency.log

Note

You can use the path /opt/bmc/RLM/releases/yourCurrentVersion/RPM/portal.war/WEB-INF/log/purge_data_requests_with_dependency.log.

After successful purging, the following request-related data is deleted from the database tables for the specified date:

  • SERVERS_STEPS
  • STEP_EXECUTION_CONDITIONS
  • LARGE_STRINGS
  • AUDITS
  • STEP_SCRIPT_ARGUMENTS
  • SCHEDULED_JOBS
  • NOTES
  • AUTOMATION_QUEUE_DATA
  • JOB_RUNS
  • UPLOADS
  • LINKED_ITEMS
  • STEP_HOLDERS
  • STEP_REFERENCES
  • STEP_REFERENCES
  • SERVER_ASPECTS_STEPS
  • SERVER_GROUPS_STEPS
  • DATA_RETRIEVER_VALUES
  • STEPS
  • ACTIVITY_LOGS
  • REQUEST_PROPERTIES
  • PROPERTY_VALUES
  • TEMPORARY_PROPERTY_VALUES
  • MESSAGES
  • EMAIL_RECIPIENTS
  • REQUEST_PACKAGE_CONTENTS
  • REQUESTS

Rake task format

The format for a rake task to purge request data from the BRPM is as follows: 

Rake task format
jruby -S rake purge_data:requests_with_dependency[<date>,<include_plan_requests>,<request_status>,<request_environment>]

This rake task consists of the following parameters to purge data from BRPM:

Parameter

Description

date

Enter the date from which the data must be purged. The date must be in DD/MM/YYYY format. If a user misses to enter the date, the default date will be one year from the date of the request being made.

include_plan_requests

Enter a flag value to show if the request is included or not. Enter YES (for included plan request) or NO (for excluded plan request). If a user misses to enter a flag value, the default flag value is NO.

request_status

Enter the status of the requests using a || separator. The following are the available request status options:

  • created
  • planned
  • started
  • problem
  • hold
  • cancelled
  • complete
  • deleted

    For requests which are completed and cancelled, enter complete||cancelled.

request_environment

Enter the environment of the request. For multiple environments, use the || separator.

Example

For a request which is in production and development, enter prod||development.

Note

The request_status and request_environment parameters are case sensitive.

To purge data from the BRPM

After the rake task is executed, you cannot restore the deleted data. Perform the following steps for purging data for a specified period.

  1. Go to RPMhome\releases\yourCurrentVersion\RPM\portal.war\WEB-INF and set the environment variable by running the following command.

    ./opt/bmc/RLM5.0.03/bin/setenv.sh
  2. Run the rake task.

    The rake task where date is specified in a DD/MM/YYYY format and the flag value for include_plan_request is YES, is shown as follows:

    Rake task for deleting requests that include requests associated with a plan
    jruby -S rake purge_data:requests_with_dependency["05/02/2018","yes"] RAILS_ENV=production

    For examples of the rake tasks including combinations of two or more parameters, see Examples of rake tasks.

    Rake task for deleting requests
    jruby -S rake purge_data:requests_with_dependency["05/02/2018"] RAILS_ENV=production

    The following sample message is displayed.

    Version 5.0.03.004
    RAILS_ROOT=/opt/bmc/RLM/releases/5.0.03.004/RPM/portal.war/WEB-INF
    W, [2019-12-13T15:58:32.015000 #23527]  WARN -- Wildfly:
    Creating scope :descending. Overwriting existing method Audit.descending.
    W, [2019-12-13T15:58:33.248000 #23527]  WARN -- Wildfly:
    Creating scope :active. Overwriting existing method User.active.
    W, [2019-12-13T15:58:33.250000 #23527]  WARN -- Wildfly:
    Creating scope :inactive. Overwriting existing method User.inactive.
    This rake task will delete all requests older than
    2020-02-05T00:00:00+00:00
    Please wait preparing estimates...
    W, [2019-12-13T15:58:49.783000 #23527]  WARN -- Wildfly:
    Creating scope :problem. Overwriting existing method Step.problem.
    W, [2019-12-13T15:58:50.825000 #23527]  WARN -- Wildfly:
    Creating scope :scheduled. Overwriting existing method Step.scheduled. 
    Version 5.0.03.003 or earlier
    RAILS_ROOT=/opt/bmc/RLM5.0.03/releases/5.0.03.00/RPM
    W, [2018-02-05T23:24:04.033000 #16109]  WARN -- TorqueBox: Creating scope :descending. Overwriting existing method Audit.descending.
    W, [2018-02-05T23:24:11.528000 #16109]  WARN -- TorqueBox: Creating scope :active. Overwriting existing method User.active.
    W, [2018-02-05T23:24:11.530000 #16109]  WARN -- TorqueBox: Creating scope :inactive. Overwriting existing method User.inactive.

    This rake task will delete all requests older than 2018-02-05T00:00:00+00:00
    Please wait preparing estimates...
    W, [2018-02-05T23:24:41.552000 #16109]  WARN -- TorqueBox: Creating scope :problem. Overwriting existing method Step.problem.
    W, [2018-02-05T23:24:46.199000 #16109]  WARN -- TorqueBox: Creating scope :scheduled. Overwriting existing method Step.scheduled.
    =========================================================================================================
    SERVERS_STEPS: 143,183
    STEP_EXECUTION_CONDITIONS: 3
    LARGE_STRINGS: 0
    AUDITS: 686,865
    STEP_SCRIPT_ARGUMENTS: 143,279
    SCHEDULED_JOBS: 8,830
    NOTES: 79,502
    AUTOMATION_QUEUE_DATA: 0
    JOB_RUNS: 70,660
    UPLOADS: 904
    LINKED_ITEMS: 0
    STEP_HOLDERS: 0
    STEP_REFERENCES: 72
    SERVER_ASPECTS_STEPS: 1,002
    SERVER_GROUPS_STEPS: 0
    DATA_RETRIEVER_VALUES: 6
    STEPS: 90,580
    ACTIVITY_LOGS: 443,578
    REQUEST_PROPERTIES: 339
    PROPERTY_VALUES: 0
    TEMPORARY_PROPERTY_VALUES: 310
    MESSAGES: 0
    EMAIL_RECIPIENTS: 24,475
    REQUEST_PACKAGE_CONTENTS: 0
    REQUESTS: 10,004
    ---------------------------------------------------------------------------------------------------------
    Total tables: 25, records: 1,703,592
    =========================================================================================================
    Are you sure you want to delete requests? [y/n]
  3. Type y to continue with the purging and press Enter.
  4. You can type n to skip the purging task. The database tables that are cleaned are displayed in the console. 
  5. After the rake task is executed successfully, the following sample message is displayed with the location of the log file.

    elapsed_time: 6.5 mm.ss

    Detailed log is
    located at:
    /opt/bmc/RLM5.0.03/releases/5.0.03.00/RPM/log/purge_data_requests_with_dependency.log

Examples of rake tasks

To purge data with date only
jruby -S rake purge_data:requests_with_dependency["05/11/2020"] RAILS_ENV=production
To purge data including plan requests
jruby -S rake purge_data:requests_with_dependency["05/11/2020","yes"] RAILS_ENV=production


To purge data with date and status
jruby -S rake purge_data:requests_with_dependency["05/11/2020","no","complete||planned"] RAILS_ENV=production


To purge data including plan requests with date and status
jruby -S rake purge_data:requests_with_dependency["05/11/2020","yes","complete||planned"] RAILS_ENV=production


To purge data with date and by specific environment
jruby -S rake purge_data:requests_with_dependency["05/11/2020","no","","Prod||Development"] RAILS_ENV=production


To purge data with date and by specific environment and status
jruby -S rake purge_data:requests_with_dependency["05/11/2020","yes","complete||planned","Prod||Development"] RAILS_ENV=production

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*