tencent cloud

文档反馈

DescribeFlowLogs

最后更新时间:2023-08-23 14:11:30

1. API Description

Domain name for API request: vpc.tencentcloudapi.com.

This API is used to query all the flow logs of the current account.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: DescribeFlowLogs.
Version Yes String Common Params. The value used for this API: 2017-03-12.
Region No String Common Params. This parameter is not required for this API.
VpcId No String ID of the VPC instance
FlowLogId No String The unique ID of the flow log.
FlowLogName No String The name of the flow log instance.
ResourceType No String The resource type of the flow log. Valid values: 'VPC', 'SUBNET', and 'NETWORKINTERFACE'.
ResourceId No String The unique ID of the resource.
TrafficType No String Type of flow logs to be collected. Valid values: 'ACCEPT', 'REJECT' and 'ALL'.
CloudLogId No String The storage ID of the flow log.
CloudLogState No String The storage ID status of the flow log.
OrderField No String Order by field. Valid values: 'flowLogName' and 'createTime'. Default value: 'createTime'.
OrderDirection No String In ascending (asc) or descending (desc) order. Default value: 'desc'.
Offset No Integer The offset. Default value: 0.
Limit No Integer The number of rows per page. Default value: 10.
Filters No Filter Filter condition. FlowLogId and Filters cannot be specified at the same time.
  • tag-key - String - Optional - Filter by the tag key.
  • tag:tag-key - String - Optional - Filter by the tag key-value pair. The tag-key should be replaced with a specified tag key.
  • CloudLogRegion No String The region corresponding to the flow log storage ID.

    3. Output Parameters

    Parameter Name Type Description
    FlowLog Array of FlowLog The instance set of flow logs.
    TotalNum Integer The total number of flow logs.
    RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

    4. Example

    Example1 Querying the list of flow logs

    This example shows you how to query the list of flow logs.

    Input Example

    POST / HTTP/1.1
    Host: vpc.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: DescribeFlowLogs
    <Common request parameters>
    
    {
        "Limit": 10,
        "Offset": 0
    }
    

    Output Example

    {
        "Response": {
            "FlowLog": [
                {
                    "CloudLogId": "dfb8f1a2-8522-47c1-8571-67905167ab3f",
                    "CloudLogRegion": "ap-guangzhou",
                    "CloudLogState": "SUCCESS",
                    "CreatedTime": "2019-05-07 18:00:26",
                    "FlowLogDescription": "",
                    "FlowLogId": "fl-2edhcclz",
                    "FlowLogName": "yuemingtest",
                    "ResourceId": "eni-78ysaex1",
                    "ResourceType": "NETWORKINTERFACE",
                    "TrafficType": "ACCEPT",
                    "VpcId": "vpc-pq9vxykj",
                    "StorageType": "cls",
                    "FlowLogStorage": {
                        "StorageTopic": "topic-siqmaox1",
                        "StorageId": "ckafka-akwiqms1"
                    },
                    "TagSet": [],
                    "Enable": true
                },
                {
                    "CloudLogId": "dfb8f1a2-8522-47c1-8571-67905167ab3f",
                    "CloudLogRegion": "ap-guangzhou",
                    "CloudLogState": "SUCCESS",
                    "CreatedTime": "2019-05-08 10:48:26",
                    "FlowLogDescription": "",
                    "FlowLogId": "fl-f42uhpkj",
                    "FlowLogName": "test",
                    "ResourceId": "eni-78ysaex1",
                    "ResourceType": "NETWORKINTERFACE",
                    "TrafficType": "ACCEPT",
                    "VpcId": "vpc-pq9vxykj",
                    "StorageType": "cls",
                    "FlowLogStorage": {
                        "StorageTopic": "topic-siqmaox1",
                        "StorageId": "ckafka-akwiqms1"
                    },
                    "TagSet": [],
                    "Enable": true
                }
            ],
            "TotalNum": 2,
            "RequestId": "404428db-f850-40c2-803d-0aae49aba43a"
        }
    }
    

    Example2 Obtaining the information of flow logs

    This example shows you how to query the information of flow logs.

    Input Example

    POST / HTTP/1.1
    Host: vpc.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: DescribeFlowLogs
    <Common request parameters>
    
    {
        "VpcId": "vpc-ew41hsdj",
        "FlowLogId": "fl-m4vogmhf"
    }
    

    Output Example

    {
        "Response": {
            "FlowLog": [
                {
                    "VpcId": "vpc-ew41hsdj",
                    "FlowLogId": "fl-m4vogmhf",
                    "FlowLogName": "sflow-nat",
                    "ResourceType": "NAT",
                    "ResourceId": "nat-prlux840",
                    "TrafficType": "ALL",
                    "CloudLogId": "29a6c8c8-d57d-4e25-84b5-9114734ce6ca",
                    "CloudLogRegion": "ap-guangzhou",
                    "CloudLogState": "SUCCESS",
                    "FlowLogDescription": "",
                    "CreatedTime": "2022-05-18 15:26:50",
                    "Enable": true,
                    "StorageType": "cls",
                    "FlowLogStorage": {
                        "StorageId": "29a6c8c8-d57d-4e25-84b5-9114734ce6ca"
                    },
                    "TagSet": []
                }
            ],
            "TotalNum": 1,
            "RequestId": "811bbd89-3c38-4926-9a8c-4bc97792aa34"
        }
    }
    

    5. Developer Resources

    SDK

    TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

    Command Line Interface

    6. Error Code

    The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

    Error Code Description
    InvalidParameterValue.Malformed Invalid input parameter format.
    InvalidParameterValue.Range The parameter value is not in the specified range.
    InvalidParameterValue.TooLong Invalid parameter value. The parameter value is too long.
    ResourceNotFound The resource does not exist.