Creates a flow log.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String No CreateFlowLog

The operation that you want to perform. Set the value to CreateFlowLog.

RegionId String Yes cn-shanghai

The ID of the region to which the flow log belongs.

You can call the DescribeRegions operation to query the most recent region list.

Description String No test

The description of the flow log.

Name String No sag-flowlog-1

The name of the flow log.

ActiveAging Integer No 300

The output interval under active connections. Valid values: 60 to 6000. Unit: seconds. Default value: 300.

InactiveAging Integer No 15

The output interval under inactive connections. Valid values: 10 to 600. Unit: seconds. Default value: 15.

OutputType String Yes all

The type of the flow log. Valid values:

  • sls: The flow log is stored in Log Service.
  • netflow: The flow log is stored on a NetFlow collector.
  • all: The flow log is stored both in Log Service and on a NetFlow collector.
SlsRegionId String No cn-shanghai

The ID of the region where Log Service is deployed.

If OutputType is set to sls or all, this parameter is required.

ProjectName String No sag-flowlog-shanghai

The project in Log Service.

If OutputType is set to sls or all, this parameter is required.

LogstoreName String No config-operation-log

The Logstore in Log Service.

If OutputType is set to sls or all, this parameter is required.

NetflowServerIp String No 192.168.0.2

The IP address of the NetFlow collector where the flow log is stored.

If OutputType is set to netflow or all, this parameter is required.

NetflowServerPort Integer No 9995

The port number of the NetFlow collector where the flow log is stored. Default value: 9995.

If OutputType is set to netflow or all, this parameter is required.

NetflowVersion String No V9

The version of the NetFlow collector where the flow log is stored. Valid values: V5, V9, and V10. Default value: V9.

If OutputType is set to netflow or all, this parameter is required.

Response parameters

Parameter Type Example Description
RequestId String 650CB9E8-20F3-4538-A4FC-1DA1B36E42D9

The ID of the request.

FlowLogId String fl-7a56mar1kfw9vj****

The ID of the flow log.

ResourceGroupId String rg-acfm2iu4f****

The ID of the resource group to which the flow log belongs.

Examples

Sample requests

http(s)://[Endpoint]/?Action=CreateFlowLog
&RegionId=cn-shanghai
&Description=test
&Name=sag-flowlog-1
&ActiveAging=300
&InactiveAging=15
&OutputType=all
&SlsRegionId=cn-shanghai
&ProjectName=sag-flowlog-shanghai
&LogstoreName=config-operation-log
&NetflowServerIp=192.168.0.2
&NetflowServerPort=9995
&NetflowVersion=V9
&Common request parameters

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<CreateFlowLogResponse>
    <RequestId>650CB9E8-20F3-4538-A4FC-1DA1B36E42D9</RequestId>
    <FlowLogId>fl-7a56mar1kfw9vj****</FlowLogId>
    <ResourceGroupId>rg-acfm2iu4f****</ResourceGroupId>
</CreateFlowLogResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "650CB9E8-20F3-4538-A4FC-1DA1B36E42D9",
  "FlowLogId" : "fl-7a56mar1kfw9vj****",
  "ResourceGroupId" : "rg-acfm2iu4f****"
}

Error codes

HttpCode Error code Error message Description
400 DependencyViolation.FlowLog This FlowLog instance is bound to an SAG instance. The error message returned because the flow log is associated with a resource.
400 IncorrectStatus.FlowLog The current FlowLog instance status does not support this operation. The error message returned because the status of the flow log does not support this operation.
400 InvalidFlowLogId.NotFound The specified FlowLogId does not exist. The error message returned because the specified flow log ID (FlowLogId) is invalid.
400 MissingParam.FlowLogId Specify the FlowLogId parameter. The error message returned because the ID (FlowLogId) of the flow log is not specified.
400 OperationFailed.AssociateFlowLog The operation failed. The specified SAG instance has already been associated with another FlowLog instance. The error message returned because the specified Smart Access Gateway (SAG) instance is associated with another flow log.
400 OperationUnsupported.AssociateFlowLog You cannot bind the SAG device of the current version or model to a FlowLog instance. The error message returned because the version or model of the SAG device does not support this operation.
400 QuotaExceeded.Flowlog The maximum number of FlowLog instances is exceeded. The error message returned because the number of flow logs that you specified has reached the upper limit.
400 MissingParam.LogstoreName Specify the LogstoreName parameter. The error message returned because the name (LogstoreName) of the Logstore is not specified.
400 MissingParam.NetflowServerIp Specify the NetflowServerIp parameter. The error message returned because the IP address (NetflowServerIp) of the server where the flow log is stored is not specified.
400 MissingParam.NetflowServerPort Specify the NetflowServerPort parameter. The error message returned because the port (NetflowServerPort) of the NetFlow collector is not specified.
400 MissingParam.NetflowVersion Specify the NetflowVersion parameter. The error message returned because the NetFlow version (NetflowVersion) is not specified.
400 MissingParam.ProjectName Specify the ProjectName parameter. The error message returned because the name (ProjectName) of the Log Service project is not specified.
400 MissingParam.SlsRegionId Specify the SlsRegionId parameter. The error message returned because the ID (SlsRegionId) of the region where Log Service is deployed is not specified.
400 IllegalParam.ActiveAging The specified ActiveAging is invalid. The error message returned because the specified time interval (ActiveAging) at which log data of active connections is collected is invalid.
400 IllegalParam.InactiveAging The specified InactiveAging is invalid. The error message returned because the specified time interval (InactiveAging) at which log data of inactive connections is collected is invalid.
400 IllegalParam.NetflowServerIp The specified NetflowServerIp is invalid. The error message returned because the specified IP address (NetflowServerIp) of the NetFlow collector is invalid.
400 IllegalParam.NetflowServerPort The specified NetflowServerPort is invalid. The error message returned because the specified port (NetflowServerPort) of the NetFlow collector is invalid.
400 IllegalParam.NetflowVersion The specified NetflowVersion is invalid. The error message returned because the specified NetFlow version (NetflowVersion) is invalid.
400 IllegalParam.OutputType The specified OutputType is invalid. The error message returned because the specified storage location (OutputType) of the flow log is invalid.
400 IllegalParam.RegionId The specified RegionId is invalid. The error message returned because the specified ID (RegionId) of the region is invalid.
400 IllegalParam.SlsRegionId The specified SlsRegionId is invalid. The error message returned because the specified ID (SlsRegionId) of the region where Log Service is deployed is invalid.
400 IllegalParam.Status The specified Status parameter is invalid. The error message returned because the specified status (Status) of the flow log is invalid.
403 FeatureNotSupport The current edition of the smart access gateway does not support this feature. The error message returned because the current version of the SAG device does not support this feature.

For a list of error codes, visit the API Error Center.