Membuat flow log.
Deskripsi operasi
Anda dapat menggunakan flow log untuk menangkap lalu lintas yang dikirimkan melalui instans transit router dan koneksi instans jaringan. Koneksi instans jaringan mencakup koneksi antar-wilayah, koneksi VPC, koneksi VPN, koneksi ECR, dan koneksi VBR. Sebelum membuat flow log, perhatikan hal-hal berikut:
-
Hanya Router transit edisi perusahaan yang mendukung flow log.
-
Untuk koneksi antar-wilayah, flow log hanya menangkap lalu lintas keluar (outbound traffic) dari transit router. Lalu lintas masuk (inbound traffic) tidak ditangkap.
Sebagai contoh, sebuah Instance Elastic Compute Service (ECS) di wilayah AS (Silicon Valley) mengakses Instance ECS di wilayah AS (Virginia) melalui Cloud Enterprise Network (CEN). Jika Anda membuat flow log untuk transit router di wilayah AS (Virginia), Anda dapat melihat pesan yang dikirim dari Instance ECS di wilayah AS (Virginia) ke Instance ECS di wilayah AS (Silicon Valley) di Konsol Simple Log Service. Namun, Anda tidak dapat melihat pesan yang dikirim dari Instance ECS di wilayah AS (Silicon Valley) ke Instance ECS di wilayah AS (Virginia). Untuk melihat pesan tersebut, Anda juga harus membuat flow log untuk transit router di wilayah AS (Silicon Valley).
-
Ketika flow log menangkap lalu lintas dari koneksi VPC, flow log hanya menangkap lalu lintas yang dikirimkan melalui elastic network interface (ENI) transit router. Untuk menangkap lalu lintas yang dikirimkan melalui ENI lainnya di VPC, lihat VPC flow log overview.
-
CreateFlowlogadalah operasi asinkron. Setelah Anda mengirim permintaan, sistem akan mengembalikan ID flow log. Namun, flow log tidak langsung dibuat. Sistem membuat flow log di latar belakang. Anda dapat memanggil operasiDescribeFlowlogsuntuk menanyakan status flow log.Jika flow log berada dalam status Creating, flow log sedang dalam proses pembuatan. Dalam status ini, Anda hanya dapat menanyakan flow log tersebut.
Jika flow log berada dalam status Active, flow log telah berhasil dibuat.
Prasyarat
Sebelum membuat flow log untuk suatu resource, pastikan resource tersebut telah dibuat. Untuk membuat resource, lihat topik-topik berikut:
Coba sekarang
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
cen:CreateFlowlog |
create |
*All Resource
|
None | None |
Parameter permintaan
|
Parameter |
Type |
Required |
Description |
Example |
| ClientToken |
string |
No |
Token klien yang digunakan untuk memastikan idempotensi permintaan. Buat nilai untuk parameter ini dari klien Anda. Pastikan nilainya unik untuk setiap permintaan. Token hanya boleh berisi karakter ASCII. Catatan
Jika Anda tidak menentukan parameter ini, sistem secara otomatis menggunakan ID permintaan sebagai token klien. ID permintaan mungkin berbeda untuk setiap permintaan. |
123e4567-e89b-12d3-a456-42665544**** |
| RegionId |
string |
Yes |
ID wilayah flow log. Anda dapat memanggil operasi DescribeChildInstanceRegions untuk mendapatkan ID wilayah. |
cn-hangzhou |
| FlowLogName |
string |
No |
Nama flow log. Nama boleh kosong atau terdiri dari 1 hingga 128 karakter. Nama tidak boleh diawali dengan `http://` atau `https://`. |
myFlowlog |
| Description |
string |
No |
Deskripsi flow log. Deskripsi boleh kosong atau terdiri dari 1 hingga 256 karakter. Deskripsi tidak boleh diawali dengan `http://` atau `https://`. |
myFlowlog |
| CenId |
string |
Yes |
ID instans CEN. |
cen-7qthudw0ll6jmc**** |
| ProjectName |
string |
No |
Proyek yang digunakan untuk menyimpan traffic yang ditangkap.
|
flowlog-project |
| LogStoreName |
string |
No |
Penyimpanan log yang digunakan untuk menyimpan traffic yang ditangkap.
|
flowlog-logstore |
| Interval |
integer |
No |
Interval agregasi untuk flow log. Satuan: detik. Nilai yang valid: 60 dan 600. Nilai default: 600. |
600 |
| TransitRouterAttachmentId |
string |
No |
ID koneksi VPC, koneksi VPN, koneksi VBR, koneksi ECR, atau koneksi antar-wilayah. Jika Anda ingin mengonfigurasi flow log untuk instans transit router, jangan tentukan parameter ini. |
tr-attach-r6g0m3epjehw57**** |
| TransitRouterId |
string |
No |
ID instans transit router. |
tr-bp1rmwxnk221e3fas**** |
| LogFormatString |
string |
No |
String kustom field log untuk flow log. Formatnya didefinisikan sebagai:
|
${srcaddr}${dstaddr}${bytes} |
| Tag |
array<object> |
No |
Tag. Anda dapat menambahkan hingga 20 tag dalam setiap panggilan. |
|
|
object |
No |
Tag. Anda dapat menambahkan hingga 20 tag dalam setiap panggilan. |
||
| Key |
string |
No |
Kunci tag. Kunci tag tidak boleh berupa string kosong. Panjang kunci tag maksimal 64 karakter dan tidak boleh diawali dengan Anda dapat menentukan hingga 20 kunci tag. |
TagKey |
| Value |
string |
No |
Nilai tag. Nilai tag boleh berupa string kosong atau string dengan panjang maksimal 128 karakter. Nilai tag tidak boleh diawali dengan Setiap kunci tag harus memiliki nilai tag yang unik. Anda dapat menentukan hingga 20 nilai tag. |
TagValue |
Elemen respons
|
Element |
Type |
Description |
Example |
|
object |
Tanggapan. |
||
| RequestId |
string |
ID permintaan. |
54B48E3D-DF70-471B-AA93-08E683A1B457 |
| Success |
string |
Menunjukkan apakah pemanggilan berhasil.
|
true |
| FlowLogId |
string |
ID flow log. |
flowlog-m5evbtbpt**** |
Contoh
Respons sukses
JSONformat
{
"RequestId": "54B48E3D-DF70-471B-AA93-08E683A1B457",
"Success": "true",
"FlowLogId": "flowlog-m5evbtbpt****"
}
Kode kesalahan
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | ProjectOrLogstoreNotExist | The specified project or logstore does not exist. | The error message returned because the specified project or Logstore does not exist. |
| 400 | SourceProjectNotExist | The Source Project or logstore does not exist. | The error message returned because the specified source project or Logstore does not exist. |
| 400 | OperationUnsupported.action | This action is not support. | The error message returned because this operation is not supported in the specified region. |
| 400 | RuleExist | The rule has already existed. | The rule already exists. |
| 400 | QuotaExceeded.FlowlogCount | This user has reached the maximum instance number of flowlog. | The error message returned because the number of flow logs has reached the upper limit. |
| 400 | InvalidFlowlogId.exist | This cenId already has flowlog instance existed. | The error message returned because the specified CEN instance is already associated with a flow log. |
| 400 | Flowlog.AlreayExist | This attachment already has existed flowlog instance. | The error message returned because the specified flow log already exists. You cannot create duplicate flow logs. |
| 400 | IllegalParam.TransitRouterAttachmentId | TransitRouterAttachmentId is illegal. | The error message returned because the specified transit router is invalid. |
| 400 | InvalidTransitRouterAttachmentId.NotFound | The TransitRouterAttachmentId is not found. | The error message returned because the specified transit router attachment ID (TransitRouterAttachmentId) does not exist. |
| 400 | IncorrectStatus.flowlog | This action is not allowed in the current flow log status. | This action is not allowed in the current flow log status. |
| 400 | InvalidOperation.TransitRouterNotExist | Operation is invalid because the transit router not exist. | The error message returned because the specified transit router does not exist. |
| 400 | IncorrectStatus.TransitRouterAttachmentId | The resource is not in a valid state for the attachment operation. | The error message returned because the operation is not supported when the specified attachment is in an unstable state |
| 400 | ProjectExist | Project already exist, please try a different project name. | The log Project already exists, try a different Project name. |
| 400 | InvalidParameter.ProjectName | Project name is invalid or does not belong to specified region. | The Project name is illegal or does not belong to the specified region. |
| 400 | IncorrectStatus.TrFlowlog | Flowlog status for specified TransitRouter is invalid for this operation. | Flowlog status for specified TransitRouter is invalid for this operation. |
| 400 | OperationInvalid.IncompatibleFlowlogExist | Operation is invalid because incompatible flowlog config exists. | There are incompatible Flowlog configurations, please delete and try again. |
| 400 | InvalidParameter.LogFormatString | LogFormatString is invalid. | The specified log format is invalid. |
| 400 | InvalidParameter.LogStoreName | Specified LogStore name is invalid. | Logstore name is invalid. |
| 400 | OperationFailed.InvalidLogInfo | The entered log service information is invalid. Check whether the ProjectName and LogStoreName are correct, and whether Log Service has been activated. | The entered log service information is invalid. Check whether the ProjectName and LogStoreName are correct, and whether Log Service has been activated. |
| 400 | IncorrectStatus.TransitRouterInstance | The status of TransitRouter is incorrect. | The error message returned because the transit router is in an invalid state. |
| 400 | InvalidParameter | Invalid parameter. | The error message returned because the parameter is set to an invalid value. |
| 400 | Unauthorized | The AccessKeyId is unauthorized. | The error message returned because you do not have the permissions to perform this operation. |
| 400 | InvalidParameter.CenId | The specified parameter CenId is invalid. | |
| 403 | NoPermission.AliyunServiceRoleForTRFlowLog | You are not authorized to create service linked role AliyunServiceRoleForTRFlowLog. | You are not authorized to create service linked role AliyunServiceRoleForTRFlowLog. |
Lihat Error Codes untuk daftar lengkap.
Catatan rilis
Lihat Release Notes untuk daftar lengkap.