Configures a Logstore for an application.

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 headers

This operation uses only the common request header. For more information, see Common request parameters.

Request syntax

POST /pop/v5/k8s/sls/update_sls_log_store HTTPS|HTTP

Request parameters

Parameter Type Required Example Description
AppId String Yes af58edcf-f7eb-****-****-db4e425f****

The ID of the application. You can call the ListApplication operation to query the application ID. For more information, see ListApplication.

Configs String Yes [{"logstore":"thisisanotherfilelog","type":"file","logDir":"/var/log/*"},{"logstore":"","type":"stdout","logDir":"stdout.log"},{"logstore":"thisisafilelog","type":"file","logDir":"/tmp/log/*"}]

Logstore configurations:

  • Configs:
    • type: the type of log to collect. Set this parameter to file to specify the file type. Set this parameter to stdout to specify the standard output type.
    • Logstore: the name of the Logstore. Make sure that the name of the Logstore is unique in the cluster. The name must comply with the following rules:
      • The name can contain only lowercase letters, digits, hyphens (-), and underscores (_).
      • The name must start and end with a lowercase letter or a digit.
      • The name must be 3 to 63 characters in length.
        Note If this parameter is empty, the system automatically generates a name.
    • LogDir: If the standard output type is used, the log path is stdout.log. If the file type is used, the log path is the path of the collected file. Specific wildcards are supported. The log path must match the following regular expression: ^/(.+)/(.*)[^/]$.

Response parameters

Parameter Type Example Description
Code Integer 200

The HTTP status code.

Message String success

The returned message.

RequestId String D16979DC-4D42-**************

The ID of the request.

Examples

Sample requests

POST /pop/v5/k8s/sls/update_sls_log_store HTTP/1.1
Common request header
{
"AppId": "af58edcf-f7eb-****-****-db4e425f****",
"Configs": "[{"logstore":"thisisanotherfilelog","type":"file","logDir":"/var/log/*"},{"logstore":"","type":"stdout","logDir":"stdout.log"},{"logstore":"thisisafilelog","type":"file","logDir":"/tmp/log/*"}]"
}

Sample success responses

XML format

<code>200</code>
<message>success</message>
<requestId>D16979DC-4D42-**************</requestId>

JSON format

{
    "code": 200,
    "message": "success",
    "requestId": "D16979DC-4D42-**************"
}

Error codes

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