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 Type | Scenario | Notes |
|---|---|---|
| Elasticsearch | Slow logs are already written to Elasticsearch | Suitable for centralized log platform scenarios. |
| Alibaba Cloud | Slow logs need to be collected from Alibaba Cloud managed databases | Currently 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, orDBClusterId.
Step 1: Open the External Collection Sources Page
Log in to the NineData Console.
In the left navigation pane, click Database DevOps > Slow Query Analysis.
On the top tab bar, click External Collection Sources.
Source 1: Elasticsearch
Step 2: Create an Elasticsearch External Collection Source
On the External Collection Sources tab, click Create External Collection Source.
Configure the drawer as follows:
Parameter Description Source Type Select Elasticsearch.Data Source Select the target Elasticsearch data source. The tested data source in this document is External Slow Log Source ( ds-dg658uv2j0bt).Source Name Enter a custom source name. Description Optional. Enter a description for this source. Collection Definition Keep the default MySQLtab.Enable Configuration Keep it enabled. Click OK to create the source.
Step 3: Test the Elasticsearch Collection Definition
Return to the External Collection Sources list, find the target source, and click Edit.
In the Collection Definition section, make sure the current tab is
MySQLand Enable Configuration is turned on.In the Fetch Slow Logs row, click Test.
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": ""
}
}After the test succeeds, the Output section displays the returned slow log data. The step status also changes to Success.
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
MySQLtab 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, andposition.
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
On the External Collection Sources tab, click Create External Collection Source.
Complete the basic configuration:
Parameter Description Source Type Select Alibaba Cloud. Related Data Source Select the data source that maps to the target Alibaba Cloud instance. Data sources created through the Alibaba Cloud entry are recommended. Source Name Enter a custom source name. Description Optional. Enter a description for this source. After the source is created, NineData generates two steps: Authorize and Fetch Slow Logs.
Step 3: Complete the Alibaba Cloud Authorization Configuration
Return to the External Collection Sources list, find the target source, and click Edit.
In the Authorize step, first confirm the following items:
Check Item Description Cloud Access Credential A 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 ID Fill in the matching identifier according to the instance type. RDS instances usually use DBInstanceId, while PolarDB clusters usually useDBClusterId. In some cases, the page may directly ask forinstance_id.tipIf the page does not auto-populate the region or instance identifier, use the exact values shown in the Alibaba Cloud console.
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
In the Fetch Slow Logs step, click Test.
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.
If the test fails, use the following table for troubleshooting:
Error or Symptom Recommended Check Cloud access credential not found Create 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 failed Check whether the credential, region, and instance ID are correct. Alibaba Cloud RDS client connection failed Check 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.