All Products
Search
Document Center

Data Management:Export operation logs of DMS to Simple Log Service

Last Updated:Nov 14, 2024

This topic describes how to export operation logs of Data Management (DMS) to Simple Log Service for processing and analysis.

Prerequisites

  • Simple Log Service is activated. For more information, see Resource management overview.

  • A Simple Log Service project and a Logstore are created. For more information, see the Create a project section of the "Manage a project" topic and the Create a Logstore section of the "Manage a Logstore" topic.

  • On the Instances tab of the DMS console, the Simple Log Service project that you create is registered with DMS. For more information, see Register an Alibaba Cloud database instance.

  • The Logstore must contain no logs and at least full-text indexes or field indexes are created for the Logstore. For more information about full-text indexes and field indexes, see Create indexes.

Background information

Operation logs record details of all the operations that are performed in DMS. For more information, see the Features section of the "Use the operation audit feature" topic.

Billing method

You can export operation logs of DMS to Simple Log Service free of charge. However, Simple Log Service charges you for storage. For more information about the billing of Simple Log Service, see Billable items of pay-by-feature.

Procedure

  1. Log on to the DMS console V5.0.
  2. In the top navigation bar, click Security and Specifications. In the left-side navigation pane, click Operation Audit.

    Note

    If you use the DMS console in simple mode, move the pointer over the 2022-10-21_15-25-22.png icon in the upper-left corner of the DMS console and choose All functions > Security and Specifications > Operation Audit.

  3. Click the Export logs tab. On the Export logs tab, click New Task in the upper-right corner.

  4. In the Create Export Task dialog box, configure the parameters that are described in the following table.

    Parameter

    Required

    Description

    The task name.

    Yes

    The name of the export task. Specify a descriptive name for easy identification.

    Destination Log Service

    Yes

    A Simple Log Service project that is used to manage resources.

    SLS Logstore

    Yes

    The Logstore to which you want to export the operation logs. The Logstore must contain no logs and you must create indexes for the Logstore.

    Note

    You can click Sync dictionary. In the message that appears, click OK. DMS automatically collects metadata of the Logstore.

    Function Module

    Yes

    The function modules whose logs you want to export. You can view the modules on the Operation Logs tab. Valid values include All, Permissions, Data Owner, Data Query, Query Results export, and Cross-database Query Result Export. By default, All is selected.

    Scheduling Method

    Yes

    The scheduling method of the export task. Valid values:

    • One-time Tasks: After you create an export task, the task exports the logs only once.

    • Periodic Tasks: You can select Day, Week, or Month to export logs to the Logstore on a periodic basis. If a periodic scheduling task runs for the first time, all operation logs that are generated in DMS from the start time of log entries to the scheduling start time are exported. Only incremental logs are exported later. For more information, see the Periodic scheduling section of this topic.

    Log Time Range

    No

    Note

    This parameter is available only if you set the Scheduling Method parameter to One-time Tasks.

    The time range within which the operation logs to be exported are generated. By default, if you do not configure this parameter, all logs generated in the last three years are exported.

    Log Start Time

    No

    Note
    • This parameter is available only if you set the Scheduling Method parameter to Periodic Tasks.

    • Periodic tasks do not have an end time.

    The start time of the logs to be exported. If you do not configure this parameter, the default value is the date three years ago from the date when the export task was created.

  5. Click OK. The log export task is created. The system also creates index fields such as dbId, dbName, and dbUser in your Logstore for data queries and analysis.

    • If a one-time task is in the Successful state, the logs are exported.

      Note

      The indexes in the Logstore take effect at a later time after they are created. Therefore, a single scheduling task starts to be run approximately 90 seconds after the task is created.

    • A periodic task exports logs multiple times and is in the Pending Scheduling state before and after the logs are exported. You can view the task logs to determine whether a task is successful.

    You can perform the following operations in the Operation column of a task.

    • Query: After you click Query, you are navigated to the SQL Console page. On the page that appears, click Query. In the Execution History section in the lower part of the page, you can view the logs that are exported to the Logstore.

    • Task Logs: Click Task Logs to view information about the task, such as the start time, end time, number of log entries to be exported, and task status.

    • Pause: Click Pause. In the dialog box that appears, click OK. Then, the periodic task is paused.

    • Restart: Click Restart. In the dialog box that appears, click OK to restart the paused task.

Periodic scheduling

Parameter

Description

Scheduling Cycle

The scheduling cycle of a task flow. Valid values:

  • Day: The task flow is run at the specified point in time every day. If you select this option, you must specify the Specific Point in Time parameter.

  • Week: The task flow is run at the specified point in time on the days that you select every week. If you select this option, you must configure the Specified Time and Specific Point in Time parameters.

  • Month: The task flow is run at the specified point in time on the days that you select every month. If you select this option, you must configure the Specified Time and Specific Point in Time parameters

Specified Time

  • If you set the Scheduling Cycle parameter to Week, select one or more days of a week from the drop-down list. DMS runs the log export task on the days that you select every week.

  • If you set the Scheduling Cycle parameter to Month, you can select one or more days of a month from the drop-down list. DMS runs the log export task on the days that you select every month.

Specific Point in Time

The point in time of the specified days at which DMS runs the task.

For example, if you set this parameter to 02:55, DMS runs the task at 02:55 on the specified days.

Cron Expression

The Cron expression that is automatically generated based on the specified scheduling cycle and time settings.

What to do next

After you export the operations logs of DMS to Simple Log Service, you can query and analyze the logs. For more information, see Query and analyze operation logs of DMS in Simple Log Service.