Queries the distribution of logs that meet the specified search conditions in a Logstore.
Operation description
Usage notes
-
Host consists of a project name and a Simple Log Service endpoint. You must specify a project in Host.
-
The time range is evenly divided into subintervals in the responses. If the time range that is specified in the request remains unchanged, the subintervals in the responses also remain unchanged.
-
If the number of logs in a Logstore significantly changes, Simple Log Service cannot predict the number of times that you must call this operation to obtain the complete result. In this case, you must check the value of the progress parameter in the response of each request and determine whether to call this operation one more time to obtain the complete result. Each time you call this operation, the same number of charge units (CUs) are consumed.
-
After a log is written to a Logstore, you can call the GetHistograms or GetLogs operation to query the log after a short latency. The latency of a query varies based on the type of the log. Simple Log Service classifies logs into the following types based on the log time:
- Real-time data: The difference between the time record in a log and the current time on Simple Log Service is within the interval (-180 seconds,900 seconds]. For example, if a log was generated at 12:03:00, September 25, 2014 (UTC) and Simple Log Service received the log at 12:05:00, September 25, 2014 (UTC), Simple Log Service processes the log as real-time data. After real-time data is written to a Logstore, the data can be queried with a maximum latency of 3 seconds.
- Historical data: The difference between the time record in a log and the current time on Simple Log Service is within the interval [-604,800 seconds,-180 seconds). For example, if a log was generated at 12:00:00, September 25, 2014 (UTC) and Simple Log Service received the log at 12:05:00, September 25, 2014 (UTC), Simple Log Service processes the log as historical data. This type of log is usually generated in data backfill scenarios.
After real-time data is written to a Logstore, the data can be queried with a maximum latency of 3 seconds. For 99.9% of queries, the latency is no more than 1 second.
- Simple Log Service provides examples on how to call the GetHistograms operation by using Simple Log Service SDK for Java. For more information, see Use GetHistograms to query the distribution of logs.
Debugging
Authorization information
Request syntax
GET /logstores/{logstore}/index?type=histogram HTTP/1.1
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
project | string | Yes | The name of the project. | ali-test-project |
logstore | string | Yes | The name of the Logstore. | test-logstore |
from | long | Yes | The start time of the subinterval. The value is a UNIX timestamp representing the number of seconds that have elapsed since the epoch time January 1, 1970, 00:00:00 UTC. | 1409529600 |
to | long | Yes | The end time of the subinterval. The value is a UNIX timestamp representing the number of seconds that have elapsed since the epoch time January 1, 1970, 00:00:00 UTC. | 1409569200 |
topic | string | No | The topic of the logs. | topic |
query | string | No | The search statement. Only search statements are supported. Analytic statements are not supported. For more information about the syntax of search statements, see Log search overview. | with_pack_meta |
Response parameters
Examples
Sample success responses
JSON
format
[
{
"from": 1409529600,
"to": 1409569200,
"count": 2,
"progress": "Complete"
}
]
Error codes
For a list of error codes, visit the Service error codes.