Bind External Log Index¶
POST /api/v1/log_index_cfg/bind
Overview¶
Bind an external log storage resource.
Prerequisites and Usage Steps¶
First prepare query permissions, actual target resources, and field mappings in the external storage, then select storeType to bind to a unique alias in this workspace. This only establishes query access configuration; it does not create external Logstores/indexes/tables, nor does it copy external data into the current workspace. SLS/TLS performs query resource validation; other types run an access test first.
SLS requires project/logstore/region and AK/SK; TLS requires project/topic names, region, iamProjectName/projectId/topicId, and AK/SK. ES/OpenSearch/Beaver require at least a URL; authentication depends on target requirements. For ClickHouse, public parameters can provide the database through exterStoreProject, and time field mapping must be configured. The current public accessCfg does not declare database/port/secure, so internal SDK options cannot be passed directly. It is currently handled with the default native connection capability; confirm availability on the deployment side first. Beaver conditions use extend.conditionStr.
Access key fields are submitted in plaintext over HTTPS and are not wrapped with frontend RSA. Binding/modification first saves to the database, then notifies downstream to refresh and clear caches. If a later step fails, the configuration may already be saved. Check the list/details and actual external queries before deciding to retry. Changing the name sends separate notifications to delete the old name and create the new name; verify the index name on the caller side.
Request Headers¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| DF-API-KEY | string | Y | OpenAPI authentication credential for the workspace. Example: <DF-API-KEY>How to obtain or enter: Obtain an OpenAPI Key with this operation permission from API Key Management in the target workspace. |
Body Request Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| extend.conditionStr | string | Beaver condition string; when provided during binding or external modification, it is saved as conditions and is not processed using the normal index extend.filters generation rules. Example: status=200How to obtain or enter: Only for Beaver according to the target storage's actual filtering syntax; verify in the target query tool first. |
|
| extend | json | Optional. When passed by external modify, it replaces the entire object; if omitted, it is retained. Avoid null; Beaver condition handling may return 500. Allows null: True Example: {}How to obtain or enter: Additional display configuration for external indexes; Beaver filtering can use conditionStr. |
|
| name | string | Y | Required local index name; recommended within 128 characters; keep it separate from the external storage name. External modification can change this local name. Allows null: False Example: external_app_logsHow to obtain or enter: Choose a unique alias for the index bound in this workspace; check the Log Index list first. |
| desc | string | Optional description; omitted on binding becomes empty; omitted on external modification also clears it. Recommended within 1024 characters. Allows null: False Allows empty string: True Example: External application logs.How to obtain or enter: Describe the external data source. |
|
| storeType | string | Y | Required for binding. External modification does not declare this field; the target's original storeType is used, and the storage type cannot be changed through this API. Public ClickHouse connection parameters are limited; see the description. Allows null: False Example: esHow to obtain or enter: Choose sls/es/opensearch/beaver/volctls/clickhouse. |
| exterStoreName | string | Y | Required external target name, not the local name alias or configuration UUID. Modification must provide it in full. Allows null: False Example: app_logsHow to obtain or enter: Obtain the actual resource name from the external console: SLS Logstore, TLS topic_name, ES/OpenSearch index, Beaver target, or ClickHouse table name. |
| exterStoreProject | string | Conditionally required for SLS/TLS; required database source for ClickHouse. When not passed in a normal external modification, some old values are retained, but SLS/TLS validation still requires complete project configuration. Allows null: False Example: app_projectHow to obtain or enter: SLS project name, TLS project_name, ClickHouse database name; usually omitted for other types. |
|
| region | string | Conditionally required for SLS/TLS; for ES/OpenSearch/Beaver/ClickHouse bindings, it is normalized to an empty region. Allows null: False Example: cn-hangzhouHow to obtain or enter: Obtain the actual region code from the target cloud resource console and ensure it is consistent with the region covered by AK permissions. |
|
| isPublicNetworkAccess | boolean | Optional. Defaults to false for SLS; ES/OpenSearch/Beaver/ClickHouse bindings are saved as true. Avoid null; this is not proof of connection reachability. Allows null: True Example: falseHow to obtain or enter: For SLS, choose according to the target access network; for a private network, ensure that the site can access the target. |
|
| accessCfg | json | Y | Required access object; provide the following fields according to storeType. OpenAPI uses plaintext and transmits it over HTTPS, without console RSA wrapping. External modification is a complete object replacement; only some sensitive values can be backfilled, so do not pass only the changed fields. Allows null: False Example: {"url": "https://logs.example.com", "username": "reader", "password": "<EXTERNAL-PASSWORD>"}How to obtain or enter: Obtain a least-privilege query account/AK from the external resource administrator; do not use this API's DF-API-KEY as a substitute. |
| accessCfg.ak | string | For normal SLS binding, it must be provided together with sk; required for TLS. External modification must also provide a valid AK. Allows null: False Example: <EXTERNAL-AK>How to obtain or enter: SLS/TLS resource access key ID, obtained from the corresponding cloud resource authorization. |
|
| accessCfg.sk | string | SLS/TLS secret. If omitted or an empty string is passed during external modification, the system attempts to retain the old SK; an empty value cannot be used to clear it. Binding must provide it in full. Allows null: False Example: <EXTERNAL-SK>How to obtain or enter: Secret paired with ak; do not write real values into logs or documents. |
|
| accessCfg.url | string | Conditionally required for the corresponding connection type; the server performs an access test. A valid address alone does not guarantee all subsequent query permissions. Allows null: False Example: https://logs.example.comHow to obtain or enter: ES/OpenSearch/Beaver actual connection address; for ClickHouse, use the connection address provided by the administrator. |
|
| accessCfg.username | string | For ES and similar targets, provide it as required by target authentication. Omitting it during external modification does not guarantee that the old username is retained; backfill it in full. Allows null: False Example: readerHow to obtain or enter: Target query account, not a member of this workspace. |
|
| accessCfg.password | string | If omitted or set to an empty string during external modification, the system attempts to backfill the old password; this cannot be treated as clearing the password. For targets without a password, it can be omitted during binding according to actual requirements. Allows null: False Example: <EXTERNAL-PASSWORD>How to obtain or enter: Target account password, transmitted over HTTPS; the example is a placeholder. |
|
| accessCfg.iamProjectName | string | TLS IAM project name, not project_name. TLS requires iamProjectName/projectId/topicId to all be non-empty and queries to verify that topicId belongs to the project. Allows null: False Allows empty string: True Example: defaultHow to obtain or enter: Obtain the corresponding resource value from the Volcengine TLS console. |
|
| accessCfg.iamProjectDisplayName | string | TLS IAM project display name; optional. TLS requires iamProjectName/projectId/topicId to all be non-empty and queries to verify that topicId belongs to the project. Allows null: False Allows empty string: True Example: Default projectHow to obtain or enter: Obtain the corresponding resource value from the Volcengine TLS console. |
|
| accessCfg.projectId | string | TLS project ID, corresponding to the exterStoreProject name. TLS requires iamProjectName/projectId/topicId to all be non-empty and queries to verify that topicId belongs to the project. Allows null: False Allows empty string: True Example: project-exampleHow to obtain or enter: Obtain the corresponding resource value from the Volcengine TLS console. |
|
| accessCfg.topicId | string | TLS log topic ID, corresponding to the exterStoreName name. TLS requires iamProjectName/projectId/topicId to all be non-empty and queries to verify that topicId belongs to the project. Allows null: False Allows empty string: True Example: topic-exampleHow to obtain or enter: Obtain the corresponding resource value from the Volcengine TLS console. |
|
| fields | array | Optional mapping array. field and non-empty originalField must both be unique; entries with an empty originalField are ignored. For TLS, if time/__docid/message are missing, they are automatically filled with the same names; ClickHouse must explicitly map time. During external modification, only non-empty valid mappings trigger replacement; [] does not clear old mappings. Allows null: False Example: [{"field": "time", "originalField": "timestamp"}, {"field": "message", "originalField": "content"}]How to obtain or enter: Select mappings from actual target fields to platform query fields; view existing mappings from details with isShowFields=true. |
|
| fields[*] | object | Mapping object. Example: {"field": "message", "originalField": "content"}How to obtain or enter: One local query field corresponds to one actual external field. |
|
| fields[*].field | string | Conditionally required | Declared as required; must be non-empty and unique. Allows null: False Example: messageHow to obtain or enter: Common platform fields time/__docid/message or other keys that need mapping. |
| fields[*].originalField | string | Conditionally required | Declared as required; an empty string can be passed, but the entry will be ignored and does not mean deleting the old mapping. Allows null: False Allows empty string: True Example: contentHow to obtain or enter: Actual field name in external storage; for example, content is mapped to message. |
Request Example¶
curl --request POST 'https://openapi.guance.com/api/v1/log_index_cfg/bind' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json' \
--data-raw '{"name":"external_app_logs","desc":"External application logs.","storeType":"es","exterStoreName":"app_logs","accessCfg":{"url":"https://logs.example.com","username":"reader","password":"<EXTERNAL-PASSWORD>"},"fields":[{"field":"time","originalField":"timestamp"},{"field":"message","originalField":"content"}]}'
Response¶
HTTP 200, application/json. The example below shows the main fields that can be read directly.
| Field | Type | Description |
|---|---|---|
| content | boolean | true on success; credentials or new configuration are not returned; read them back through the list/details. |
{
"code": 200,
"content": true,
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
Error Responses¶
For authentication, rate limiting, and common request errors, see Common Error Definitions.
| HTTP Status | errorCode | Trigger Condition | Message or Response Description | Resolution |
|---|---|---|---|---|
| 406 | ft.ParameterValidationFailed | Request field is missing, or the field value violates the declared validation conditions | Parameter parsing failed | Check the parameter location, field name, type, and value. |
| 400 | ft.RequestJsonFormatError | Request JSON syntax is invalid | Request JSON format error | Fix the JSON according to content.reason, line, and column. |
| 400 | ft.JsonFormatError | JSON top level is not an object, or the policy is not an object | Some JSON file format error | Submit an object according to the parameter table; storagePolicy uses a JSON object. |
| 429 | ft.OperationTooFrequently | Concurrent storage write/index relationship operations in the same workspace, or lock lease expiration | Your operation is too frequent. Please try again later | Wait for in-flight operations to complete, then back off and retry; query the current state first. |
| 500 | ft.InternalServerError | Database, cache, downstream connection/common 5xx, or abnormal field shape | Internal error | First read the configuration and verify the current state of the actual storage. If the failure persists, provide traceId; do not treat the error as unsaved or as a reason to directly repeat the addition. |
| 406 | ft.InvalidParameterValidation | Required AK/SK/URL and other values for the corresponding storage are empty | The value of {} is invalid; current value: {} |
Provide the complete corresponding access configuration according to storeType. |
| 406 | ft.DataStoreCfgAkSkOrAccountIdIsMissing | SLS is missing AK/SK and no cloud account ID is available | Storage configuration parameter error: missing ak/sk or missing cloud account ID | For initial public binding, use complete AK/SK; external modification can use the cloud account ID according to public fields. |
| 406 | ft.DataStoreCfgAkSkIsMissing | TLS is missing AK/SK | Storage configuration parameter error: missing ak/sk | Provide the corresponding secret. |
| 406 | ft.InvalidTlsIamORProjectORTopic | TLS project/region/topic information is incomplete, or topic validation does not match | TLS Iam/project/topic is invalid | Check the names, IDs, and authorization relationships. |
| 400 | ft.CustomStoreLogstoreInvalid | SLS target did not return a valid query mode | Invalid custom cloud resource | Check that the Logstore exists, its type, and authorization. |
| 400 | ft.TestExternalResourceAccessInvalid | Access connectivity test failed for non-SLS/TLS | Test failed. Check whether the configuration is correct and ensure that the network connection is normal | Check the network, address, and target access permissions. |
| 406 | ft.ObjectFieldNameRepeat | field is duplicated | Field {} in the mapping configuration is duplicated |
Configure only one mapping for each target field. |
| 406 | ft.ObjectOriginalFieldNameRepeat | originalField is duplicated | Mapped field {} in the mapping configuration is duplicated |
Use each source field only once. |
| 400 | ft.ForIndexCfgNameExists | An active index with the same name already exists in this workspace | The specified index configuration name already exists | Choose a unique alias. |
| 400 | ft.LogIndexCfgNameHasUsed | The binding alias conflicts with an internal index name that has been used | The specified index configuration name has already been used | Change the alias; do not reuse internal historical names. |
| 400 | ft.WKSPTypeUnsupportAction | The free/Free Plan edition does not support binding | The current workspace edition does not support it | Confirm that the edition supports it before integration. |
| 403 | ft.Forbidden | Insufficient permissions, or the current edition does not allow this API | You do not have permission to perform this operation | Use an API Key with the corresponding index permission and a supported edition. |