:original_name: ListFlowLogs.html
.. _ListFlowLogs:
Querying Flow Logs
==================
Function
--------
This API is used to query the flow log list.
Constraints
-----------
- Filtering query is supported. You can use **resource_type**, **resource_id**, and **enterprise_project_id** for query. You can query multiple resources at a time or use combined criteria to query resources.
- Pagination query is supported. You can use **limit** and **marker** together for query.
- Sorting by a single field. You can use **id**, **name**, or **state** to sort resources. Sorting by multiple fields is not supported.
URI
---
GET /v3/{project_id}/enterprise-router/{er_id}/flow-logs
.. table:: **Table 1** Path Parameters
========== ========= ====== ====================
Parameter Mandatory Type Description
========== ========= ====== ====================
project_id Yes String Project ID
er_id Yes String Enterprise router ID
========== ========= ====== ====================
.. table:: **Table 2** Query Parameters
+-----------------+-----------------+-----------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Parameter | Mandatory | Type | Description |
+=================+=================+=================+=====================================================================================================================================================================+
| resource_type | No | String | Resource type |
+-----------------+-----------------+-----------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| resource_id | No | Array | Attachment resource IDs |
+-----------------+-----------------+-----------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| limit | No | Integer | Number of records on each page. Value range: **0** to **2000** |
| | | | |
| | | | Minimum: **0** |
| | | | |
| | | | Maximum: **2000** |
+-----------------+-----------------+-----------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| marker | No | String | ID of the last enterprise router on the previous page. If this parameter is left blank, the first page is queried. This parameter must be used together with limit. |
| | | | |
| | | | Minimum: **1** |
| | | | |
| | | | Maximum: **128** |
+-----------------+-----------------+-----------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| sort_key | No | Array | Keyword for sorting. The keyword can be **id**, **name**, or **state**. By default, **id** is used. |
+-----------------+-----------------+-----------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| sort_dir | No | Array | Sorting order. There are two value options: **asc** (ascending order) and **desc** (descending order). The default value is **asc**. |
+-----------------+-----------------+-----------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Request Parameters
------------------
None
Response Parameters
-------------------
**Status code: 200**
.. table:: **Table 3** Response body parameters
+------------+------------------------------------------------------------------+------------------------------+
| Parameter | Type | Description |
+============+==================================================================+==============================+
| flow_logs | Array of :ref:`FlowLog ` objects | Flow log details |
+------------+------------------------------------------------------------------+------------------------------+
| request_id | String | Request ID |
+------------+------------------------------------------------------------------+------------------------------+
| page_info | :ref:`PageInfo ` object | Pagination query information |
+------------+------------------------------------------------------------------+------------------------------+
.. _listflowlogs__response_flowlog:
.. table:: **Table 4** FlowLog
+--------------------------+---------+----------------------------------------------------------------------------------------------------------------------+
| Parameter | Type | Description |
+==========================+=========+======================================================================================================================+
| id | String | Flow log ID |
+--------------------------+---------+----------------------------------------------------------------------------------------------------------------------+
| name | String | Flow log name |
+--------------------------+---------+----------------------------------------------------------------------------------------------------------------------+
| description | String | Flow log description |
+--------------------------+---------+----------------------------------------------------------------------------------------------------------------------+
| project_id | String | Project ID of the flow log task creator |
+--------------------------+---------+----------------------------------------------------------------------------------------------------------------------+
| resource_type | String | Resource type. The value is **attachment**. |
+--------------------------+---------+----------------------------------------------------------------------------------------------------------------------+
| resource_id | String | Resource ID |
+--------------------------+---------+----------------------------------------------------------------------------------------------------------------------+
| log_group_id | String | Log group ID |
+--------------------------+---------+----------------------------------------------------------------------------------------------------------------------+
| log_stream_id | String | Log stream ID |
+--------------------------+---------+----------------------------------------------------------------------------------------------------------------------+
| log_store_type | String | Flow log storage type. LTS is used for log storage. |
+--------------------------+---------+----------------------------------------------------------------------------------------------------------------------+
| log_store_name | String | Flow log storage name. This parameter is not supported for now. |
+--------------------------+---------+----------------------------------------------------------------------------------------------------------------------+
| log_aggregation_interval | Integer | Log aggregation time, in seconds. The value ranges from **60** to **600**. |
+--------------------------+---------+----------------------------------------------------------------------------------------------------------------------+
| created_at | String | Creation time in the format YYYY-MM-DDTHH:mm:ss.sssZ |
+--------------------------+---------+----------------------------------------------------------------------------------------------------------------------+
| updated_at | String | Update time in the format YYYY-MM-DDTHH:mm:ss.sssZ |
+--------------------------+---------+----------------------------------------------------------------------------------------------------------------------+
| state | String | Flow log status. Value options: **pending**, **available**, **modifying**, **deleting**, **deleted**, and **failed** |
+--------------------------+---------+----------------------------------------------------------------------------------------------------------------------+
| enabled | Boolean | Whether to enable flow logs. The value can be **true** or **false**. |
+--------------------------+---------+----------------------------------------------------------------------------------------------------------------------+
.. _listflowlogs__response_pageinfo:
.. table:: **Table 5** PageInfo
+---------------+---------+-------------------------------------------------------------------------------------------------------------------+
| Parameter | Type | Description |
+===============+=========+===================================================================================================================+
| next_marker | String | Marker of the next page. The value is the resource UUID. If the value is empty, the resource is on the last page. |
+---------------+---------+-------------------------------------------------------------------------------------------------------------------+
| current_count | Integer | Number of resources in the list |
+---------------+---------+-------------------------------------------------------------------------------------------------------------------+
Example Requests
----------------
Querying flow logs
.. code-block:: text
GET https://{erouter_endpoint}/v3/0605767a9980d5762fbcc00b3537e757/enterprise-router/a43c55e9-4911-4030-90e1-5c2bf6ae6fe2/flow-logs
Example Responses
-----------------
**Status code: 200**
OK
.. code-block::
{
"flow_logs" : [ {
"id" : "b216bc1d-5963-41a7-89f9-779a5128c5ac",
"name" : "flow_log",
"project_id" : "0605767a9980d5762fbcc00b3537e757",
"resource_type" : "attachment",
"resource_id" : "6f83b848-8331-4271-ac0c-ef94b7686402",
"log_group_id" : "0139393c-eeb2-49f0-bbd4-c5faec6b1497",
"log_stream_id" : "d22c3b44-2f71-470f-83f3-96a8af6956ad",
"log_store_type" : "LTS",
"log_aggregation_interval" : 600,
"created_at" : "2020-03-11T15:13:31Z",
"updated_at" : "2022-03-11T15:13:31Z",
"state" : "available",
"enabled" : true,
"description" : "Flow Logs"
} ],
"page_info" : {
"next_marker" : "1",
"current_count" : 1
},
"request_id" : "915a14a6-867b-4af7-83d1-70efceb146f9"
}
Status Codes
------------
=========== ===========
Status Code Description
=========== ===========
200 OK
=========== ===========
Error Codes
-----------
See :ref:`Error Codes `.