UpdateNamespaceSlsConfigs

Updated at:

Updates the Simple Log Service (SLS) configuration at the namespace level.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

sae:UpdateNamespaceSlsConfigs

update

*All Resource

*

None None

Request syntax

POST /pop/cas/namespace/updateNamespaceSlsConfigs HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

NamespaceId

string

No

The ID of the namespace.

cn-beijing:test

NameSpaceShortId

string

No

The short ID of the namespace. The region is not required. This parameter is recommended.

test

SlsConfigs

string

No

The configuration for collecting logs to Simple Log Service (SLS).

  • To use SLS resources automatically created by Serverless App Engine (SAE): [{"logDir":"","logType":"stdout"},{"logDir":"/tmp/a.log"}].

  • To use custom SLS resources: [{"projectName":"test-sls","logType":"stdout","logDir":"","logstoreName":"sae","logtailName":""},{"projectName":"test","logDir":"/tmp/a.log","logstoreName":"sae","logtailName":""}].

The parameter settings are as follows:

  • projectName: the name of the SLS project.

  • logDir: the log path.

  • logType: the log type. stdout indicates container standard output logs. Only one stdout log can be set. If it is not set, file logs are collected.

  • logstoreName: the name of the SLS Logstore.

  • logtailName: the name of the SLS Logtail. If this parameter is not specified, a new Logtail is created.

If the SLS collection configuration remains unchanged during multiple deployments, you do not need to set this parameter (that is, the SlsConfigs field is not required in the request). If you no longer need the SLS collection feature, you must set the value of this field to an empty string (that is, set the SlsConfigs field to "") in the request.

Note

A project automatically created with a job template is deleted when the job template is deleted. Therefore, when you select an existing project, you cannot select a project automatically created by SAE.

[{"projectName":"test","logDir":"/tmp/a.log","logstoreName":"sae","logtailName":""}]

SlsLogEnvTags

string

No

sls log tags

[]

Response elements

Element

Type

Description

Example

object

Schema of Response

requestId

string

Id of the request

AD0286B2-F4A4-5D43-9329-97DEF1019F06

Message

string

The additional information.

success

TraceId

string

The trace ID used to precisely query call information.

0a98a02315955564772843261e****

ErrorCode

string

The error code. Valid values:

  • Successful request: The ErrorCode field is not returned.

  • Failed request: The ErrorCode field is returned. For more information, see the Error codes section in this topic.

InvalidNamespaceId.NotFound

Code

string

The API status code or POP error code. Valid values: 2xx: success. 3xx: redirection. 4xx: request error. 5xx: server error.

200

Success

boolean

Indicates whether the SLS configuration for the namespace was updated successfully. Valid values:

  • true: The configuration was updated successfully.

  • false: The configuration failed to be updated.

true

Examples

Success response

JSON format

{
  "requestId": "AD0286B2-F4A4-5D43-9329-97DEF1019F06",
  "Message": "success",
  "TraceId": "0a98a02315955564772843261e****",
  "ErrorCode": "InvalidNamespaceId.NotFound",
  "Code": "200",
  "Success": true
}

Error codes

HTTP status code

Error code

Error message

Description

404 InvalidNamespaceId.NotFound The specified NamespaceId does not exist. The specified NamespaceId does not exist.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.