ModifySqlLogConfig

更新时间:
复制 MD 格式

Use the ModifySqlLogConfig operation to enable or configure DAS Enterprise Edition for a database instance.

Operation description

Before calling this operation, ensure you meet the following requirements:

  • Use the latest version of the Alibaba Cloud SDK or the DAS SDK.

  • When calling the DAS service with an SDK, set the region to cn-shanghai.

  • This operation enables the latest supported version of DAS Enterprise Edition by default. See DAS editions and supported features for the databases and regions supported by each version of DAS Enterprise Edition.

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

hdm:ModifySqlLogConfig

update

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

InstanceId

string

Yes

The ID of the database instance.

rr-2ze770smbq3tp****

Enable

boolean

No

Indicates whether to enable DAS Enterprise Edition. Valid values:

  • true: enables DAS Enterprise Edition.

  • false: disables DAS Enterprise Edition.

Note

This parameter is required when you enable DAS Enterprise Edition. By default, this operation enables the latest supported version.

true

RequestEnable

boolean

No

Indicates whether to enable SQL Explorer. Valid values:

  • true: enables SQL Explorer.

  • false: disables SQL Explorer.

Note

This parameter is required only if you enable DAS Enterprise Edition V3.

true

Retention

integer

No

The data retention period, in days. Valid values:

  • 7

  • 30

  • 180

  • 365

Note

If you enable DAS Enterprise Edition V3, the value of this parameter must be 30 or greater.

30

HotRetention

integer

No

The hot storage retention period, in days. The value must be an integer from 1 to 7.

Note

This parameter is required only if you enable DAS Enterprise Edition V3.

1

Filters

array<object>

No

A reserved parameter.

object

No

A reserved parameter.

Key

string

No

A reserved parameter.

None

Value

string

No

A reserved parameter.

None

EnableAudit

boolean

No

Indicates whether to enable security audit.

true

DAS Enterprise Edition is available in four versions: V0, V1, V2, and V3. By default, the latest supported version is enabled.

  • For a database instance that supports only DAS Enterprise Edition V0, specify only the Enable and Retention parameters.

  • For a database instance that supports DAS Enterprise Edition V1, specify only the Enable and Retention parameters. The system automatically enables SQL Explorer, which sets RequestEnable to true by default.

  • For a database instance that supports DAS Enterprise Edition V2, specify only the Enable and Retention parameters. The system automatically enables SQL Explorer, which sets RequestEnable to true by default. It also sets the hot data storage duration (HotRetention) to 7 days and the cold data storage duration to Retention - 7 days.

Response elements

Element

Type

Description

Example

object

Code

string

The status code returned.

200

Message

string

The response message.

Note

If the request is successful, Successful is returned. Otherwise, an error message is returned.

Successful

RequestId

string

The request ID.

03C88D8E-1541-518E-8BFF-BEC6589B6334

Success

string

Indicates whether the request was successful. Valid values:

  • true: The request was successful.

  • false: The request failed.

false

Data

object

The returned data.

SqlLogVisibleTime

integer

The time when DAS Enterprise Edition was enabled. This value is a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC.

1683712800000

RequestStopTime

integer

The expiration time of DAS Enterprise Edition. This value is a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC.

1715335200000

CollectorVersion

string

The version of the database collector. Valid values:

  • MYSQL_V0: MySQL V0

  • MYSQL_V1: MySQL V1

  • MYSQL_V2: MySQL V2

  • MYSQL_V3: MySQL V3

  • PG_V1: PostgreSQL V1

  • rdspg_v1: ApsaraDB RDS for PostgreSQL V1

  • polarpg_v1: PolarDB for PostgreSQL V1

MYSQL_V3

SupportVersion

string

The latest supported version of DAS Enterprise Edition. Valid values:

  • SQL_LOG_V0: DAS Enterprise Edition V0

  • SQL_LOG_V1: DAS Enterprise Edition V1

  • SQL_LOG_V2: DAS Enterprise Edition V2

  • SQL_LOG_V3: DAS Enterprise Edition V3

  • SQL_LOG_NOT_ENABLE: DAS Enterprise Edition is not enabled.

  • SQL_LOG_NOT_SUPPORT: DAS Enterprise Edition is not supported.

SQL_LOG_V3

ColdRetention

integer

The retention period of the cold data. Unit: day. This value is calculated by using the following formula: Retention - HotRetention.

23

SqlLogEnable

boolean

Indicates whether DAS Enterprise Edition is enabled.

  • true: Enabled.

  • false: Disabled.

true

Retention

integer

The total retention period of data. Unit: day.

30

HotRetention

integer

The retention period of the hot data. Unit: day.

7

RequestEnable

boolean

Indicates whether SQL Explorer is enabled.

  • true: Enabled.

  • false: Disabled.

false

Version

string

The current version of DAS Enterprise Edition. Valid values:

  • SQL_LOG_V0: DAS Enterprise Edition V0

  • SQL_LOG_V1: DAS Enterprise Edition V1

  • SQL_LOG_V2: DAS Enterprise Edition V2

  • SQL_LOG_V3: DAS Enterprise Edition V3

  • SQL_LOG_NOT_ENABLE: DAS Enterprise Edition is not enabled.

  • SQL_LOG_NOT_SUPPORT: DAS Enterprise Edition is not supported.

SQL_LOG_V3

RequestStartTime

integer

The time when SQL Explorer was enabled. This value is a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC.

1683712800000

HotEnable

boolean

Indicates whether the hot data storage is enabled.

  • true: Enabled.

  • false: Disabled.

true

HotStartTime

integer

The time when the hot data storage was enabled. This value is a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC.

1683712800000

ColdEnable

boolean

Indicates whether the cold data storage is enabled.

  • true: Enabled.

  • false: Disabled.

true

ColdStartTime

integer

The time when the cold data storage was enabled. This value is a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC.

1683712800000

SqlLogState

string

The data migration state. Valid values:

  • FINISH: The historical data is migrated.

  • RUNNING: The historical data is being migrated.

  • FAILURE: The historical data fails to be migrated.

FINISH

LogFilter

string

A reserved parameter.

None

SqlLogSource

string

The source of the audit log.

Examples

Success response

JSON format

{
  "Code": "200",
  "Message": "Successful",
  "RequestId": "03C88D8E-1541-518E-8BFF-BEC6589B6334",
  "Success": "false",
  "Data": {
    "SqlLogVisibleTime": 1683712800000,
    "RequestStopTime": 1715335200000,
    "CollectorVersion": "MYSQL_V3",
    "SupportVersion": "SQL_LOG_V3",
    "ColdRetention": 23,
    "SqlLogEnable": true,
    "Retention": 30,
    "HotRetention": 7,
    "RequestEnable": false,
    "Version": "SQL_LOG_V3",
    "RequestStartTime": 1683712800000,
    "HotEnable": true,
    "HotStartTime": 1683712800000,
    "ColdEnable": true,
    "ColdStartTime": 1683712800000,
    "SqlLogState": "FINISH",
    "LogFilter": "None",
    "SqlLogSource": ""
  }
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParams The request parameters are invalid.
403 NoPermission You are not authorized to do this action.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.