Skip to content

SLS to DQL



POST /api/v1/sls/convert

Overview

Converts an Alibaba Cloud SLS query statement to a Guance DQL, without querying data in the workspace.

Body Request Parameters

Parameter Name 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; if not provided or an empty array is passed, no index restriction is applied.
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 review the differences using diagnostics before execution;
  • unsupported: The current SLS syntax is not supported; dql may be empty.

Studio always uses the log namespace L. indexes is optional; if not provided or an empty array is passed, no index restriction is applied.

Example Request

curl 'https://openapi.guance.com/api/v1/sls/convert' \\
  -H 'Content-Type: application/json' \\
  -H 'DF-API-KEY: <DF-API-KEY>' \\
  --data-raw '{"query":"status:200","indexes":["default"]}'

Response

{
    "code": 200,
    "content": {
        "status": "exact",
        "dql": "L::re(`.*`):(*)",
        "diagnostics": []
    },
    "errorCode": "",
    "message": "",
    "success": true,
    "traceId": "TRACE-XXXX"
} 

Feedback

Is this page helpful?