通过调用CreateGatewayLogging创建网关日志监控。

调用该接口时,您需要注意:

  • 请确保您已创建云存储网关。
  • 从1.0.39版本开始网关支持日志监控功能,对于本地文件网关,请联系我们加白名单后才能使用日志监控功能。
  • 只有网关日志监控状态为未创建网关日志监控(None)时,才可以创建网关日志监控。
  • 您可以通过DescribeGatewayLogging接口查询网关日志监控的状态。
  • 请确保您已创建并有可用的日志项目Project和日志库Logstore,如果没有,您需先创建Project和Logstore。详情请参见创建Project创建Logstore
  • 创建日志监控10分钟后,您可以登录日志服务控制台查看文件网关日志。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

请求参数

名称 类型 是否必选 示例值 描述
Action String CreateGatewayLogging

系统规定参数。取值:CreateGatewayLogging。

GatewayId String gw-000eg44nmxbsfwbvq***

网关ID。

SlsLogstore String logs***

日志服务(SLS) Logstore。

SlsProject String alex***

日志服务(SLS) Project。

返回数据

名称 类型 示例值 描述
Code String 200

状态码。状态码为200表示请求成功。

Message String successful

请求结果描述。

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

请求ID。

Success Boolean true

请求是否成功。

示例

请求示例

http(s)://[Endpoint]/?Action=CreateGatewayLogging
&GatewayId=gw-000eg44nmxbsfwbvq***
&SlsLogstore=logs***
&SlsProject=alex***
&<公共请求参数>

正常返回示例

XML格式

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

JSON格式

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

错误码

HttpCode 错误码 错误信息 描述
400 EmptyGatewayId You must enter a valid ID for the gateway. 网关ID不能为空。
400 EmptySlsProject You must specify a valid project of Log Service. 日志服务(SLS)项目Project不能为空。
400 EmptySlsLogstore You must specify a valid Logstore of Log Service. 日志服务(SLS)日志库Logstore不能为空。
400 GatewayVersionNotAllowed The specified version for the gateway is invalid. You must specify a valid version. 网关版本不支持,请确认输入参数是否正确。
400 GatewayLoggingStatusNotAllowed Failed to perform the operation because log monitoring is not enabled. 网关日志监控状态不支持此操作,请检查后重试。
400 GatewayNotExist The specified gateway does not exist. You must specify a valid parameter. 网关不存在,请确认输入参数是否正确。
404 StorageBundleNotExist The name you specified for the gateway cluster does not exist. You must specify a valid parameter. 网关集群不存在,请确认输入参数是否正确。
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. 请正确输入您在该网关所在地域用于日志监控的日志服务(SLS) project 和 logstore。
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. 云存储网关需要的跨服务授权角色不存在,请授予云存储网关服务相应权限。
403 NoPermission Insufficient permissions. We recommend that you contact the administrator of the Alibaba Cloud account to grant the required permissions to you. 没有足够的权限,请联系云账号管理员授予您相应权限。
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. 跨服务授权失败,请重试,如果多次尝试失败,请提交工单。

访问错误中心查看更多错误码。