SLS to DQL¶
POST /api/v1/sls/convert
Overview¶
Converts an Alibaba Cloud SLS query statement to a log DQL query without querying data in the workspace.
Body Request Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| query | string | Y | Alibaba Cloud SLS query statement Allow empty: False Allow empty string: False |
| indexes | array | Optional, list of Log Index names; when not passed or an empty array is passed, indexes are not restricted Allow empty: False |
Additional Parameter Notes¶
The returned status indicates the equivalence level of the conversion:
exact: the generated DQL is equivalent to the original SLS query;approximate: an approximate DQL has been generated; the caller should confirm the differences usingdiagnosticsbefore executing;unsupported: the current SLS syntax is not supported, anddqlmay be empty.
Studio always uses the log namespace L. indexes is optional; when not passed or an empty array is passed, no index restriction is added.
The following response only shows the structure, and dql uses a placeholder value. The actual conversion result should preserve the status:200 filter and the default index constraint from the request. Before executing the query, use the DQL actually returned by the API and check status and diagnostics.
Request Example¶
curl 'https://openapi.truewatch.com/api/v1/sls/convert' \
-H 'Content-Type: application/json' \
-H 'DF-API-KEY: <DF-API-KEY>' \
--data-raw '{"query":"status:200","indexes":["default"]}'