Manage service logs

Updated at:

Use the service log feature to obtain resource operation logs (create, modify, update, and delete) and task execution logs (scheduled SQL, data import, and data shipping) from a Project; consumer group latency logs from a LogStore; and Logtail error, heartbeat, and statistics logs. This topic describes how to enable, disable, and modify service log configurations.

Background information

When you enable the service log feature, you can select the service log type, including detailed log, important log, and task execution log. For more information about the log types and their fields, see Service log types.

  • Detailed log: Log Service creates a LogStore named internal-operation_log and a dashboard in the selected Project.

  • Important log: Log Service records logs, such as consumer group latency and Logtail heartbeat logs, in a LogStore named internal-diagnostic_log within the selected Project.

  • Task execution log: Log Service records execution logs for tasks such as data import, scheduled SQL, and data shipping in a LogStore named internal-diagnostic_log within the selected Project.

Service logs and the event logs delivered by ActionTrail are independent of each other and do not overlap in content. Service logs record operations on SLS's own resources, such as the creation, modification, and deletion of Projects and LogStores, and read/write operations on log data; these logs are stored in internal-operation_log. Event logs delivered by ActionTrail record management operations on cloud resources and are stored in LogStores whose names start with actiontrail_. If you use a Project to store ActionTrail event logs, we recommend that you enable detailed log. Detailed logs record the create, modify, update, and delete operations performed on resources within the Project, so you can track any modification or deletion of the ActionTrail logs shipped to the Project. For cross-account log shipping scenarios, after you enable detailed log in the destination account's Project, the create, modify, and delete operations performed on LogStores within that Project are also recorded in internal-operation_log, so you can trace audit activity for the ActionTrail logs shipped across accounts. internal-operation_log does not support deleting a single log entry; log data in internal-operation_log is cleared only after its retention period expires, which preserves the integrity of the audit trail.

Billing

  • Detailed log: Detailed logs are billed in the same way as a standard LogStore. For more information, see Billable items in pay-by-feature mode.

  • Important log: Ingestion, storage, and query analysis are free of charge. You are charged on a pay-as-you-go basis for operations such as data processing and data shipping.

  • Task execution log: Ingestion, storage, and query analysis are free of charge. You are charged on a pay-as-you-go basis for operations such as data processing and data shipping.

Prerequisites

  • A Project is created. For more information, see Manage a Project.

  • If you are a RAM user, an Alibaba Cloud account must grant you the required permissions. For information about how to grant permissions, see Create and authorize a RAM user. The following template shows a custom permission policy:

    Sample custom permission policy

    {
      "Version": "1",
      "Statement": [
        {
          "Action": [
            "log:CreateDashboard",
            "log:UpdateDashboard",
            "log:GetDashboard"
          ],
          "Resource": "acs:log:*:*:project/{your-log-project}/dashboard/*",
          "Effect": "Allow"
        },
        {
          "Action": [
            "log:GetProject",
            "log:CreateProject",
            "log:ListProject"
          ],
          "Resource": "acs:log:*:*:project/*",
          "Effect": "Allow"
        },
        {
          "Action": [
            "log:List*",
            "log:Create*",
            "log:Get*",
            "log:Update*"
          ],
          "Resource": "acs:log:*:*:project/{your-log-project}/logstore/*",
          "Effect": "Allow"
        },
        {
          "Action": [
            "log:*"
          ],
          "Resource": "acs:log:*:*:project/{your-source-project}/logging",
          "Effect": "Allow"
        }
      ]
    }

Enable service logs

Important

Only service logs generated after you enable this feature are recorded.

  1. Log on to the Simple Log Service console.

  2. In the Projects section, click the one you want.

    image

  3. On the details page of the target Project, click the Service Log tab.

  4. In the right-side panel, configure the parameters as described in the following table and click OK.

    Parameter description

    Parameter

    Description

    Enable service log

    See the Background information section in this topic.

    Log storage location

    • Automatic Creation (Recommended): Log Service automatically creates a Project in the same region and names it log-service-{user ID}-{region}. We recommend that you store all service logs in the same region in this Project.

    • Current Project: The service logs are stored in the current Project.

    • Other Projects in the drop-down list: Store the service logs in another existing Project in the current region.

Modify service log configurations

  1. On the target Project page, click image to go to the details page.

  2. On the details page of the target Project, click 设置图标 on the Service Log tab. In the panel that appears on the right, modify Enable Service Logs and the log storage location, and then click OK.

    The service log types are detailed log, important log, and task execution log. You can enable or disable each type.

    Important
    • We recommend that you store service logs in the Project that is created by using the Automatic Creation (Recommended) option. All service logs from Projects in the same region can be stored in a single Project.

    • After you change the log storage location, new service logs are written to the specified Project. Existing log data is not migrated from the original Project. If you no longer need this data, you must manually delete the original Project.

Disable service logs

  1. On the target Project page, click image to open its details page, and then click 设置图标 on the Service Log tab.

  2. In the Modify Service Log Settings panel, under Enable Service Logs, deselect all log types and click OK.

    Important

    Disabling the service log feature does not automatically delete existing log data. This data is cleared only after its retention period expires. If you no longer need the data, you can manually delete the Project.