Purge the metrics database


You can use the dbpurger command to connect to your metrics database and to purge old data. This command also enables you to retain a specified amount of data, and to archive all data.

For details on configuring the connection to your metrics database, see the API Gateway Installation Guide.

Note   API Gateway Analytics is deprecated and will be removed in a future release.

Run the dbpurger command

You can run the dbpurger command from the following directory:

Windows INSTALL_DIR\analytics\Win32\bin
Linux/UNIX INSTALL_DIR/analytics/posix/bin

dbpurger options

You can specify the following options to the dbpurger command:

Option Description
-h, --help Displays help message and exits.
-p PASSPHRASE, --passphrase=PASSPHRASE Specifies the configuration passphrase (leave blank for zero length).
--dbname=DBNAME Specifies the database name (mutually exclusive with dburl, dbuser, and dbpass options).
--dburl=DBURL Specifies the database URL.
--dbuser=DBUSER Specifies the database user.
--dbpass=DBPASS Specifies the database passphrase.
--archive Archive all data.
--out=OUT Archive all data in the specified directory.
--purge Purge data from the database. You must also specify the --retain option.

Specifies the amount of data to retain (for example, 30days, 1month, or 1year).You must specify this option with the --retain option.

Example dbpurger commands

This section shows examples of running dbpurger in default interactive mode and of specifying command-line options.

Run dbpurger in interactive mode

The following example shows the output when running the dbpurger command in interactive mode. This example archives all data, retains three months of data, and purges older data from the database:

Specify dbpurger command options

The following example shows the output when specifying options the dbpurger command. This example retains 30 days of data, and purges older data from the database:

Note   You can run dbpurger without a password by specifying the name of the database connection. For example:

Related Links