Skip to main content

Configure External Collection Sources for Slow Query Analysis

NineData lets you supplement slow query analysis with external collection sources. Elasticsearch and Alibaba Cloud sources are currently supported. This is useful when slow logs have already been centralized in a logging platform or need to be collected from the cloud vendor side.

Supported Source Types

Source TypeScenarioNotes
ElasticsearchSlow logs are already written to ElasticsearchSuitable for centralized log platform scenarios.
Alibaba CloudSlow logs need to be collected from Alibaba Cloud managed databasesCurrently supports RDS MySQL, RDS PostgreSQL, PolarDB for MySQL, and PolarDB for PostgreSQL.

Prerequisites

  • You have created or joined an organization, and this organization has subscribed to either DevOps Pro or DevOps Enterprise. Please ensure that your annual or monthly subscription is still active. For more information, please refer to Manage Organizations.
  • Your current account has switched to the target organization. For more information, please refer to Switching to an Organization.
  • Your account has access to Slow Query Analysis.
  • If you use Elasticsearch:
    • The Elasticsearch data source has already been added to NineData.
    • The target Elasticsearch cluster already contains slow log data that matches the NineData external collection script requirements.
  • If you use Alibaba Cloud:
    • Alibaba Cloud access credentials have already been configured in NineData. For more information, see Configure Cloud Vendor Access Credentials.
    • The target Alibaba Cloud data source has already been added. It is recommended to create or bind the instance through the Alibaba Cloud entry whenever possible.
    • You have confirmed the instance region and instance ID information in advance to avoid test failures caused by missing RegionId, DBInstanceId, or DBClusterId.

Step 1: Open the External Collection Sources Page

  1. Log in to the NineData Console.

  2. In the left navigation pane, click Database DevOps > Slow Query Analysis.

  3. On the top tab bar, click External Collection Sources.

Source 1: Elasticsearch

Step 2: Create an Elasticsearch External Collection Source

  1. On the External Collection Sources tab, click Create External Collection Source.

  2. Configure the drawer as follows:

    ParameterDescription
    Source TypeSelect Elasticsearch.
    Data SourceSelect the target Elasticsearch data source. The tested data source in this document is External Slow Log Source (ds-dg658uv2j0bt).
    Source NameEnter a custom source name.
    DescriptionOptional. Enter a description for this source.
    Collection DefinitionKeep the default MySQL tab.
    Enable ConfigurationKeep it enabled.
  3. Click OK to create the source.

Step 3: Test the Elasticsearch Collection Definition

  1. Return to the External Collection Sources list, find the target source, and click Edit.

  2. In the Collection Definition section, make sure the current tab is MySQL and Enable Configuration is turned on.

  3. In the Fetch Slow Logs row, click Test.

  4. In the Input box of the test dialog, replace the default example with the following JSON, then click Start Test:

    {
    "DATASOURCE_ID": "ds-dg658uv2j0bt",
    "DB_ID": "",
    "DB_TYPE": "",
    "POSITION": {
    "index": "",
    "lastTaskEndTime": "",
    "sort": ""
    }
    }
  5. After the test succeeds, the Output section displays the returned slow log data. The step status also changes to Success.

  6. Click Close to exit the test dialog.

Step 4: Confirm the Elasticsearch Configuration Status

After you return to the edit drawer, confirm the following:

  • The MySQL tab shows Success.
  • The Fetch Slow Logs step also shows Success.

Then click OK to save or leave the page.

Elasticsearch Validation Result

The Elasticsearch source was validated on March 12, 2026 with data source ds-dg658uv2j0bt:

  • NineData successfully connected to the Elasticsearch data source.
  • NineData successfully read external slow log data.
  • The test output returned multiple slow log records.
  • The response included fields such as data, hasNext, and position.

Source 2: Alibaba Cloud

Supported Alibaba Cloud Instances

Alibaba Cloud external collection sources are suitable when slow logs need to be collected from Alibaba Cloud managed databases. The current supported instance types are:

  • RDS MySQL
  • RDS PostgreSQL
  • PolarDB for MySQL
  • PolarDB for PostgreSQL

Step 2: Create an Alibaba Cloud External Collection Source

  1. On the External Collection Sources tab, click Create External Collection Source.

  2. Complete the basic configuration:

    ParameterDescription
    Source TypeSelect Alibaba Cloud.
    Related Data SourceSelect the data source that maps to the target Alibaba Cloud instance. Data sources created through the Alibaba Cloud entry are recommended.
    Source NameEnter a custom source name.
    DescriptionOptional. Enter a description for this source.
  3. After the source is created, NineData generates two steps: Authorize and Fetch Slow Logs.

Step 3: Complete the Alibaba Cloud Authorization Configuration

  1. Return to the External Collection Sources list, find the target source, and click Edit.

  2. In the Authorize step, first confirm the following items:

    Check ItemDescription
    Cloud Access CredentialA configured Alibaba Cloud access credential must be selected. If it is missing, the page may show errors such as “Cloud access credential not found”.
    RegionIdRequired. Enter the Alibaba Cloud region where the instance is located, for example cn-hangzhou.
    Instance IDFill in the matching identifier according to the instance type. RDS instances usually use DBInstanceId, while PolarDB clusters usually use DBClusterId. In some cases, the page may directly ask for instance_id.
    tip

    If the page does not auto-populate the region or instance identifier, use the exact values shown in the Alibaba Cloud console.

  3. If the page or test dialog shows an error similar to “Alibaba Cloud RDS client connection failed”, check the following first:

    • Whether the bound data source was created through the cloud vendor entry.
    • Whether the access credential has permission to access the target instance.
    • Whether the region and instance ID match the target instance.

Step 4: Test Alibaba Cloud Slow Log Collection

  1. In the Fetch Slow Logs step, click Test.

  2. Follow the page prompts and confirm the following:

    • The Authorize step is valid.
    • The Fetch Slow Logs step can start successfully.
    • After the test succeeds, the step status changes to Success.
  3. If the test fails, use the following table for troubleshooting:

    Error or SymptomRecommended Check
    Cloud access credential not foundCreate Alibaba Cloud access credentials in NineData first.
    Missing RegionIdFill in the instance region.
    Missing DBInstanceId / DBClusterId / instance_idFill in the instance identifier required by the instance type.
    Alibaba Cloud connection validation failedCheck whether the credential, region, and instance ID are correct.
    Alibaba Cloud RDS client connection failedCheck whether the data source was created through the cloud vendor entry and whether the system is using the correct RDS connection path.

Additional Notes for Alibaba Cloud Sources

  • The Alibaba Cloud flow contains at least two steps: Authorize and Fetch Slow Logs. Finish authorization checks before testing slow log collection.
  • If you maintain multiple Alibaba Cloud instances, record the region and instance ID by instance type to avoid mixing parameters.
  • If the target instance was added through the Alibaba Cloud entry, region and instance validation are usually easier to complete.