public static final class GetLogsRequest.Builder extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
GetLogsRequest |
build() |
GetLogsRequest.Builder |
from(Integer from)
The beginning of the time range to query.
|
GetLogsRequest.Builder |
line(Long line)
The maximum number of logs to return for the request.
|
GetLogsRequest.Builder |
logstore(String logstore)
The Logstore whose logs you want to query.
|
GetLogsRequest.Builder |
offset(Long offset)
The line from which the query starts.
|
GetLogsRequest.Builder |
powerSql(Boolean powerSql)
Specifies whether to enable the Dedicated SQL feature.
|
GetLogsRequest.Builder |
project(String project)
The name of the project.
|
GetLogsRequest.Builder |
query(String query)
The search statement or the query statement.
|
GetLogsRequest.Builder |
reverse(Boolean reverse)
Specifies whether to return logs in reverse chronological order of log timestamps.
|
GetLogsRequest.Builder |
to(Integer to)
The end of the time range to query.
|
GetLogsRequest.Builder |
topic(String topic)
The topic of the logs.
|
public GetLogsRequest.Builder project(String project)
The name of the project.
This parameter is required.
example:ali-test-project
public GetLogsRequest.Builder logstore(String logstore)
The Logstore whose logs you want to query.
This parameter is required.
example:example-logstore
public GetLogsRequest.Builder from(Integer from)
The beginning of the time range to query. The value is the log time that is specified when log data is written.
To ensure that full data can be queried, specify a query time range that is accurate to the minute. If you also specify a time range in an analytic statement, Simple Log Service uses the time range specified in the analytic statement for query and analysis.
If you want to specify a time range that is accurate to the second in your analytic statement, you must use the from_unixtime or to_unixtime function to convert the time format. For more information about the functions, see from_unixtime function and to_unixtime function. Examples:
* | SELECT * FROM log WHERE from_unixtime(__time__) > from_unixtime(1664186624) AND from_unixtime(__time__) < now()* | SELECT * FROM log WHERE __time__ > to_unixtime(date_parse(\"2022-10-19 15:46:05\", \"%Y-%m-%d %H:%i:%s\")) AND __time__ < to_unixtime(now())This parameter is required.
example:1627268185
public GetLogsRequest.Builder line(Long line)
The maximum number of logs to return for the request. This parameter takes effect only when the query parameter is set to a search statement. Minimum value: 0. Maximum value: 100. Default value: 100. For more information, see Perform paged queries.
example:100
public GetLogsRequest.Builder offset(Long offset)
The line from which the query starts. This parameter takes effect only when the query parameter is set to a search statement. Default value: 0. For more information, see Perform paged queries.
example:0
public GetLogsRequest.Builder powerSql(Boolean powerSql)
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.
example:false
public GetLogsRequest.Builder query(String query)
The search statement or the query statement. For more information, see Log search overview and Log analysis overview. If you add set session parallel_sql=true; to the analytic statement in the query parameter, Dedicated SQL is used. For example, you can set the query parameter to * | set session parallel_sql=true; select count(*) as pv. For more information about common errors that may occur during log query and analysis, see How do I resolve common errors that occur when I query and analyze logs?
example:If you specify an analytic statement in the value of the query parameter, the line and offset parameters do not take effect. In this case, we recommend that you set the line and offset parameters to 0 and use the LIMIT clause to limit the number of logs to return on each page. For more information, see Paged query.
status: 401 | SELECT remote_addr,COUNT(*) as pv GROUP by remote_addr ORDER by pv desc limit 5
public GetLogsRequest.Builder reverse(Boolean reverse)
Specifies whether to return logs in reverse chronological order of log timestamps. The log timestamps are accurate to the minute. Valid values:
false
public GetLogsRequest.Builder to(Integer to)
The end of the time range to query. The value is the log time that is specified when log data is written.
To ensure that full data can be queried, specify a query time range that is accurate to the minute. If you also specify a time range in an analytic statement, Simple Log Service uses the time range specified in the analytic statement for query and analysis.
If you want to specify a time range that is accurate to the second in your analytic statement, you must use the from_unixtime or to_unixtime function to convert the time format. For more information about the functions, see from_unixtime function and to_unixtime function. Examples:
* | SELECT * FROM log WHERE from_unixtime(__time__) > from_unixtime(1664186624) AND from_unixtime(__time__) < now()* | SELECT * FROM log WHERE __time__ > to_unixtime(date_parse(\"2022-10-19 15:46:05\", \"%Y-%m-%d %H:%i:%s\")) AND __time__ < to_unixtime(now())This parameter is required.
example:1627269085
public GetLogsRequest.Builder topic(String topic)
The topic of the logs. The default value is an empty string. For more information, see Topic.
example:topic
public GetLogsRequest build()
Copyright © 2025. All rights reserved.