Mengambil data log dari shard tertentu dalam rentang waktu yang ditentukan.
Sintaks permintaan
aliyunlog log pull_log --project_name=<value> --logstore_name=<value> --shard_id=<value> --from_time=<value> --to_time=<value> [--batch_size=<value>] [--compress=<value>] [--access-id=<value>] [--access-key=<value>] [--sts-token=<value>] [--region-endpoint=<value>] [--client-name=<value>] [--jmes-filter=<value>] [--format-output=<value>] [--decode-output=<value>]
Parameter permintaan
Tabel berikut menjelaskan parameter yang tersedia.
|
Parameter Name |
Type |
Required |
Example |
Description |
|
--project_name |
String |
Yes |
aliyun-test-project |
Nama Proyek. |
|
--logstore_name |
String |
Yes |
logstore-a |
Nama Logstore. |
|
--shard_id |
Integer |
Yes |
0 |
ID shard. |
|
--from_time |
String |
Yes |
2021-06-01 18:15:00+8:00 |
Waktu mulai. Gunakan Stempel waktu UNIX atau format |
|
--to_time |
String |
Yes |
2021-06-01 18:18:00+8:00 |
Waktu akhir. Gunakan Stempel waktu UNIX atau format |
|
--batch_size |
String |
No |
1000 |
Jumlah log per Batch. |
|
--compress |
Boolean |
No |
true |
Apakah data log yang dikembalikan akan dikompresi.
|
Untuk opsi CLI global, lihat Global parameters.
Contoh
-
Contoh permintaan
Ambil log dari rentang waktu tertentu menggunakan akun default:
aliyunlog log pull_log --project_name="ali-test-project" --logstore_name="nginx-moni" --shard_id=0 --from_time="2023-03-02 10:05:54" --to_time="2023-03-02 10:20:54" --format-output=json,no_escape -
Contoh respons
{ "count": 20, "logs": [ { "__source__": "30.15.*.125", "__tag__:__client_ip__": "124.89.*.166", "__tag__:__receive_time__": "1719382997", "__time__": 1719382927, "__topic__": "", "request_method": "GET", "status": "200" }, { "__source__": "30.15.*.125", "__tag__:__client_ip__": "124.89.*.166", "__tag__:__receive_time__": "1719382997", "__time__": 1719382927, "__topic__": "", "request_method": "POST", "status": "200" } ], "next_cursor": "MTcxOTIwOTUyMDQ5MjY3ODUxNw==" } { "count": 0, "logs": [], "next_cursor": "MTcxOTIwOTUyMDQ5MjY3ODUxNw==" }
Untuk tips pemecahan masalah, lihat CLI FAQ.