Sends multiple logs to Simple Log Service in one request.
Operation description
Usage notes
- The information that is required to query logs is obtained. The information includes the name of the project to which the logs belong, the region of the project, and the name of the Logstore to which the logs belong. For more information, see Manage a project and Manage a Logstore.
- You can call this operation to collect logs from web pages or clients.
- If you use web tracking to collect logs and you do not call this operation, you can send only one log to Simple Log Service in a request. For more information, see Use web tracking to collect logs.
- If you want to collect a large amount of log data, you can call this operation to send multiple logs to Simple Log Service in one request.
- Before you can call this operation to send logs to a Logstore, you must enable web tracking for the Logstore. For more information, see Use web tracking to collect logs.
- You cannot call this operation to send the logs of multiple topics to Simple Log Service at a time.
- If you call this operation, anonymous users from the Internet are granted the write permissions on the Logstore. This may generate dirty data because AccessKey pair-based authentication is not performed.
Debugging
Authorization information
Request syntax
POST /logstores/{logstoreName}/track HTTP/1.1
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
project | string | Yes | The name of the project. | ali-test-project |
logstoreName | string | Yes | The name of the Logstore. | ali-test-logstore |
body | object | Yes | The request body. | |
__topic__ | string | No | The topic of the logs. | topic |
__source__ | string | Yes | The source of the logs. | source |
__logs__ | array<object> | Yes | The logs. Each element is a JSON object that indicates a log. Note
Note: The time in a log that is collected by using the web tracking feature is the time at which Simple Log Service receives the log. You do not need to configure the __time__ field for each log. If this field exists, it is overwritten by the time at which Simple Log Service receives the log.
| |
object | No | The logs. | ||
string | No | The log content. | { "key1": "value1", "key2": "value2" } | |
__tags__ | object | No | The tags of the logs. | |
string | No | The tag of the log. |
Only the following request headers are supported. The first two request headers are required when you call the PutWebTracking operation. For more information about the formats and descriptions of the request headers, see Common request headers.
- x-log-apiversion: 0.6.0
- x-log-bodyrawsize: 1234
- x-log-compresstype: lz4
The x-log-compresstype header is required only when you need to send compressed data. To send compressed data, you must use the LZ4 or DEFLATE algorithm. You can specify x-log-compresstype: lz4
or x-log-compresstype: deflate
. For more information about how to compress data, see Data compression.
Response parameters
Examples
Sample success responses
JSON
format
{}
Error codes
For a list of error codes, visit the Service error codes.