All Products
Search
Document Center

Cloud Storage Gateway:CreateGatewayLogging

Last Updated:Jan 08, 2024

Configures log monitoring for a gateway.

When you call the operation, take note of the following information:

  • Make sure that you have created a gateway.
  • File gateways V1.0.39 and later support the log monitoring feature. If your gateway is deployed on your data center, contact Cloud Storage Gateway (CSG) technical support to add your Alibaba Cloud account to the whitelist.
  • You can configure log monitoring for a gateway only once.
  • You can call the DescribeGatewayLogging operation to query whether log monitoring is configured for a gateway.
  • Make sure that you have created a project and a Logstore that are available. Otherwise, create a project and a Logstore first. For more information, see Create a project and Create a Logstore.
  • You can view the log data of the file gateway in the Log Service console 10 minutes after you configure log monitoring.

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 Yes CreateGatewayLogging

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

GatewayId String Yes gw-000eg44nmxbsfwbvq***

The gateway ID.

SlsLogstore String Yes logs***

The name of the Logstore.

SlsProject String Yes alex***

The name of the project.

Response parameters

Parameter Type Example Description
Code String 200

The HTTP status code. If the request was successful, 200 is returned.

Message String successful

The description of the request result.

RequestId String 76109369-5729-467D-D4A3-1131A8DA19XX

The request ID.

Success Boolean true

Indicates whether the request was successful.

Examples

Sample requests

http(s)://[Endpoint]/?Action=CreateGatewayLogging
&GatewayId=gw-000eg44nmxbsfwbvq***
&SlsLogstore=logs***
&SlsProject=alex***
&<Common request parameters>

Sample success responses

XML format

<CreateGatewayLoggingResponse>
      <Message>successful</Message>
      <RequestId>DE962F95-B0A4-424B-BA4F-00A5839EF0AF</RequestId>
      <Code>200</Code>
      <Success>true</Success>
</CreateGatewayLoggingResponse>

JSON format

{
    "Message":"successful",
    "RequestId":"DE962F95-B0A4-424B-BA4F-00A5839EF0AF",
    "Code":"200",
    "Success":true
}

Error codes

HTTP status code Error code Error message Description
400 EmptyGatewayId You must enter a valid ID for the gateway. No gateway ID is specified.
400 EmptySlsProject You must specify a valid project of Log Service. No project is specified.
400 EmptySlsLogstore You must specify a valid Logstore of Log Service. No Logstore is specified.
400 GatewayVersionNotAllowed The specified version for the gateway is invalid. You must specify a valid version. The gateway version is not supported. Check whether the parameters are valid.
400 GatewayLoggingStatusNotAllowed Failed to perform the operation because log monitoring is not enabled. The operation is not supported while the log monitoring project is in the current state. Try again later.
400 GatewayNotExist The specified gateway does not exist. You must specify a valid parameter. The specified gateway does not exist. Check whether the parameters are valid.
404 StorageBundleNotExist The name you specified for the gateway cluster does not exist. You must specify a valid parameter. The specified gateway cluster does not exist. Check whether the parameters are valid.
400 InvalidLogstore You must specify a valid project and Logstore of Log Service. The project and Logstore must reside in the same region as the gateway. You can use the project and Logstore to monitor logs. The name of the project or Logstore is invalid.
404 RoleNotExist The role that Cloud Storage Gateway needs to obtain cross-service authorization does not exist. You must grant the required permissions to Cloud Storage Gateway. The RAM role used to authorize access to CSG does not exist.
403 NoPermission Insufficient permissions. We recommend that you contact the administrator of the Alibaba Cloud account to grant the required permissions to you. You do not have sufficient permissions. Ask the administrator to grant you the required permissions.
403 AssumeRoleFail Failed to perform cross-service authorization. Try again later. If the error persists after several tries, we recommend that you submit a ticket. The RAM role failed to be granted access to CSG. Try again later. If the error persists, submit a ticket.

For a list of error codes, see Service error codes.