You can call this operation to create 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.

Description String Yes Create a flow log

The description of the flow log.

InactiveAging Integer Yes 15

The time interval at which log data of inactive connections is collected. Valid values: 10 to 600. Default value: 15. Unit: second.

LogstoreName String Yes config-operation-log

The Logstore of Log Service. This parameter is required when OutputType is set to sls or all.

Name String Yes sag-flowlog-1

The name of the flow log.

NetflowServerIp String Yes 192.168.0.2

The IP address of the NetFlow collector where the flow log is stored. This parameter is required when OutputType is set to netflow or all.

NetflowServerPort Integer Yes 9995

The port of the NetFlow collector. Default value: 9995. This parameter is required when OutputType is set to netflow or all.

NetflowVersion String Yes V9

The NetFlow version. Valid values: V5, V9, and V10. Default value: V9. This parameter is required when OutputType is set to netflow or all.

OutputType String Yes sls

The location where the flow log is stored. 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.
ProjectName String Yes sag-flowlog-shanghai

The project to which the Logstore of Log Service belongs. This parameter is required when OutputType is set to sls or all.

RegionId String Yes cn-shanghai

The ID of the region where the flow log is deployed.

SlsRegionId String Yes cn-shanghai

The ID of the region where Log Service is deployed. This parameter is required when OutputType is set to sls or all.

ActiveAging Integer No 300

The time interval at which log data of active connections is collected. Valid values: 60 to 6000. Default value: 300. Unit: second.

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.

Examples

Sample requests

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

Sample success responses

XML format

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

JSON format

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

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 an SAG instance.
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 (FlowLogId) does not exist.
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 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 type 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 have created 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 version of the SAG instance does not support this feature.

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