Queries logs in a project. You can use this operation to query logs at the project level.
Operation description
Usage notes
- You can use the query parameter to specify a standard SQL statement.
- You must specify a project in the domain name of the request.
- You must specify a Logstore in the FROM clause of the SQL statement. A Logstore can be used as an SQL table.
- You must specify a time range in the SQL statement by using the __date__ parameter or __time__ parameter. The value of the __date__ parameter is a timestamp, and the value of the __time__ parameter is an integer. The unit of the __time__ parameter is seconds.
- Host consists of a project name and a Simple Log Service endpoint. You must specify a project in Host.
Debugging
Authorization information
There is currently no authorization information disclosed in the API.
Request syntax
GET /logs
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
project | string | Yes | The name of the project. | ali-test-project |
query | string | Yes | The standard SQL statement. In this example, the SQL statement queries the number of page views (PVs) from 2022-03-01 10:41:40 to 2022-03-01 10:56:40 in a Logstore whose name is nginx-moni. | SELECT COUNT(*) as pv FROM nginx-moni where __time__ > 1646102500 and __time__ < 1646103400 |
powerSql | boolean | No | Specifies whether to enable the Dedicated SQL feature. For more information, see Enable Dedicated SQL. Valid values:
You can use the powerSql or query parameter to configure Dedicated SQL. | false |
Response parameters
Examples
Sample success responses
JSON
format
[
{
"key": "{\"Key1\" : \"value\"}"
}
]
Error codes
For a list of error codes, visit the Service error codes.