This documentation is for WSO2 API Manager 2.2.0. View documentation for the latest release.

All docs This doc

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Updated the heading for the TOC

...

  1. Sign in to the WSO2 API-M Analytics Management Console.
    https://<APIM-ANALYTICS_HOST>:<APIM-ANALYTICS_PORT>/carbon/
  2. In the Main tab, click Data Explorer to open the Data Explorer page.
  3. Select the required table in the Table Name field, and click Schedule Data Purging as shown below. 

    Note

    The Schedule Data Purging option is displayed only for users who have a role that has the record delete permission enabled. The latter permission can be Delete permission under Record enabled. For instructions on setting this permission to users, see WSO2 DAS-Specific User Permissions.

    Expand
    titleClick here to see where the record delete permission is found in the permission tree..
    1. Sign in to the WSO2 API-M Analytics Management Console.
      https://<APIM-ANALYTICS_HOST>:<APIM-ANALYTICS_PORT>/carbon/
    2. Click Configure and thereafter click List which is under the User and Roles tab.
    3. Click Roles.
    4. Click Permissions to see the permissions that are assigned to specific user roles.
      The API-M Analytics related user permissions are highlighted in the following screen shot together with the record delete permission.
    Note

    As WSO2 API-M Analytics is based on WSO2 DAS 3.2.0, for more information on WSO2 API-M Analytics related user permissions, see WSO2 DAS-Specific User Permissions in the WSO2 Data Analytics Server documentation.



    This opens the Schedule Data Purging dialog box.

  4. In the Schedule Data Purging dialog box, set the time and days within which you want to purge data as shown below. Then click Save.

    Note

    If you are purging the statistics related tables, do not purge data that is less than 2 days old, because it can result in a data loss. However, the latter mentioned criteria is not applicable when working with alert related tables.

    FieldDescription
    Enable Data PurgingWhether you want to enable data purging or not.
    Schedule Time (Either cron string or HH:MM)Enter the time at which you want to purge data via a cron expression or by defining the time in the following format: HH:MM. For example, the following cron expression will configure the data purging job to run at 12:00 PM (noon) every day :  0 0 12 * * ?  For more information on cron expressions, go to Oracle Documentation.
    Purge Record Older Than (Days)Define the value that determines as to how long you will be storing data in a table (i.e., keep data that corresponds to the last 'n' number of days back in the selected table. For example, if you give 1 as the value, the system will purge all data stored before yesterday.
  5. Repeat these steps individually for all the tables mentioned above, so that you can ensure that all the data from the respective tables are cleared regularly.

Removing scheduled data purging operations

Follow the instructions below to remove a data purging operation that you have already scheduled.

...

  1. Open the <API-M_ANALYTICS_HOME>/repository/conf/analytics/analytics-config.xml file.
  2. Change the contents under the <analytics-data-purging> property as shown below:

    Code Block
    languagexml
    <analytics-data-purging>
        <purging-enable>true</purging-enable>
        <cron-expression>0 0 12 * * ?</cron-expression>
        <purge-include-tables>
             <table>ORG_WSO2_APIMGT_STATISTICS_WORKFLOW</table>
        	 <table>ORG_WSO2_APIMGT_STATISTICS_PERMINUTEREQUEST</table>
        	 <table>ORG_WSO2_APIMGT_STATISTICS_PERHOURREQUEST</table>
        	 <table>ORG_WSO2_APIMGT_STATISTICS_PERDAYREQUEST</table>
        	 <table>ORG_WSO2_APIMGT_STATISTICS_PERMINUTERESPONSE</table>
        	 <table>ORG_WSO2_APIMGT_STATISTICS_PERHOURRESPONSE</table>
        	 <table>ORG_WSO2_APIMGT_STATISTICS_PERDAYRESPONSE</table>
        	 <table>ORG_WSO2_APIMGT_STATISTICS_PERMINUTEEXECUTIONTIMES</table>
        	 <table>ORG_WSO2_APIMGT_STATISTICS_PERHOUREXECUTIONTIMES</table>
        	 <table>ORG_WSO2_APIMGT_STATISTICS_PERDAYEXECUTIONTIMES</table>
        	 <table>ORG_WSO2_APIMGT_STATISTICS_THROTTLE</table>
        	 <table>ORG_WSO2_APIMGT_STATISTICS_FAULT</table>
        	 <table>LOGANALYZER</table>
        	 <table>ORG_WSO2_CARBON_IDENTITY_OAUTH_TOKEN_ISSUANCE</table>
          </purge-include-tables>
        <data-retention-days>2</data-retention-days>
      </analytics-data-purging>
    Note

    Change the data-retention-days based on your requirement. Note that if you are purging the statistics related tables, do not purge data that is less than 2 days old, because it can result in a data loss. However, the latter mentioned criteria is not applicable when working with alert related tables.

    The properties of the above configuration file are shown below.

    PropertyDescription
    <purging-enable>
    Change the value to true if you want to enable data purging.
    <cron-expression>
    The cron expression to define how you want to schedule the data purging operation. For example, the following cron expression will configure the archive job to run at  12:00 PM (noon) every day :  0 0 12 * * ?  For more information on cron expressions, go to Oracle Documentation.
    <purge-include-tables>
    Specify the tables of which you want to purge data. By default, it is configured to perform data purging on all tables as follows:

    <table>.*</table> However, you can specify the required tables by defining a regular expression or a table name within the <table> property. Define one tag for each regular expression if you want to specify multiple tables.

    <data-retention-days>
    Define the value in order to retain data of only the last 'n' number of days in the selected table. For example, 365, which is the default value, will purge all data stored before a year.
  3. Save your changes.

Disabling data purging in a clustered mode

In a clustered mode you can disable the scheduled data purging tasks being operated in a particular node (e.g., a node which is used for database tasks) using a start up parameter. Start the API Analytics of that particular node by executing the following command to disable data purging:  

...