Mengambil data log dari posisi kursor tertentu. Operasi ini mengambil log mentah. Untuk mengkueri atau menganalisis log, panggil operasi GetLogsV2.
Deskripsi operasi
This operation is not supported by the OpenAPI SDK. Use the Simple Log Service SDK.
-
Specify a shard to retrieve logs.
-
This operation supports reading data in only the Protocol Buffer format.
-
The Host in the request syntax consists of the project name and the Simple Log Service endpoint. Specify the project in the Host.
Coba sekarang
Test
RAM authorization
Sintaks permintaan
GET /logstores/{logStore}/shards/{shardId}?type=log HTTP/1.1
Path Parameters
|
Parameter |
Type |
Required |
Description |
Example |
| project |
string |
Yes |
Nama Proyek. |
ali-test-project |
| logStore |
string |
Yes |
Nama penyimpanan log. |
ali-test-logstore |
| shardId |
integer |
Yes |
ID shard di penyimpanan log. |
1 |
Parameter permintaan
|
Parameter |
Type |
Required |
Description |
Example |
| cursor |
string |
Yes |
Kursor yang menentukan posisi awal untuk membaca data. |
MTQ0NzMyOTQwMTEwMjEzMDkwNA |
| count |
integer |
Yes |
Jumlah LogGroups yang dikembalikan. Nilai harus berupa bilangan bulat dari 1 hingga 1000. |
1000 |
| end_cursor |
string |
No |
Kursor yang menentukan posisi akhir untuk berhenti membaca data. |
MTU1NzA1NzQwMTEwMjEzMDkwCg |
| query |
string |
No |
Pernyataan filter dalam sintaks Bahasa Proses Terstruktur (SPL). Untuk informasi lebih lanjut, lihat Instruksi SPL. |
* | where userId='123' |
| Accept-Encoding |
string |
No |
Format kompresi data yang dikembalikan server. Hanya format lz4 yang didukung. |
lz4 |
Header permintaan berikut khusus untuk operasi PullLogs:
-
Accept: application/x-protobuf.
-
Accept-Encoding: lz4.
Nilai Accept-Encoding dapat berupa lz4, deflate, atau tanda kutip ganda ("").
Contoh permintaan:.
GET /logstores/sls-test-logstore/shards/0?type=logs&cursor=MTQ0NzMyOTQwMTEwMjEzMDkwNA&count=1000 HTTP/1.1
Host:ali-test-project.ap-southeast-1.log.aliyuncs.com
Content-Type:application/json
```.
Elemen respons
|
Element |
Type |
Description |
Example |
| LogGroupList |
The compressed data in protobuf format. |
Header respons berikut khusus untuk operasi PullLogs:
-
x-log-cursor: Kursor untuk log berikutnya yang akan dibaca.
-
x-log-end-of-cursor: Kursor log terakhir yang dibaca dalam permintaan saat ini.
-
x-log-count: Jumlah log yang dikembalikan.
Untuk informasi tentang header respons umum operasi API Simple Log Service, lihat Header respons umum.
Body respons berisi data yang diserialkan dalam format protobuf. Data dapat dikompresi.
Contoh
Respons sukses
JSONformat
{
"logGroupList": [
{
"Topic": "topic-test",
"Source": "192.1.1.1",
"LogTags": [
{
"Key": "key-test",
"Value": "value-test"
}
],
"LogItems": [
{
"Time": 1690254376,
"Contents": [
{
"Key": "key-test",
"Value": "value-test"
}
]
}
]
}
]
}
Kode kesalahan
Lihat Error Codes untuk daftar lengkap.
Catatan rilis
Lihat Release Notes untuk daftar lengkap.