Enable real-time log query

更新时间:
复制 MD 格式

Before you query and analyze logs, you must enable the real-time log query feature. This topic describes how to enable this feature for OSS access logs in the OSS console.

Prerequisites

  • You have an OSS bucket. For more information, see Create buckets.

    Make sure that the Simple Log Service project and the OSS bucket are in the same Alibaba Cloud account and region.

  • You have authorized Simple Log Service to assume the AliyunLogImportOSSRole RAM role to access OSS.

    Click Cloud Resource Access Authorization and follow the on-screen instructions to complete the authorization. This is a one-time action that must be performed by an Alibaba Cloud account.

    Warning

    Do not revoke the authorization or delete the RAM role. Otherwise, OSS access logs cannot be shipped to Simple Log Service.

Procedure

Important

If you use a RAM user to enable the real-time log query feature, you must first grant the RAM user the required permissions. For more information, see Authorize a RAM user.

Enable real-time query when creating a bucket

  1. Log on to the OSS console.

  2. Click Buckets, and then click Create Bucket.

  3. In the Create Bucket panel, turn on the Real-time Log Query switch.

    For information about other parameters, see Create buckets.

  4. Click OK.

Enable real-time query for an existing bucket

  1. Log on to the OSS console.

  2. In the left-side navigation pane, click Buckets. On the Buckets page, find and click the desired bucket.

  3. In the left-side navigation pane, choose Logging > Real-time Query.

  4. Click Enable Now.

Related operations

If you no longer need the real-time log query feature, follow these steps to disable it.

  1. Log on to the OSS console.

  2. In the left-side navigation pane, click Buckets. On the Buckets page, find and click the desired bucket.

  3. In the left-side navigation pane, choose Logging > Real-time Query.

  4. In the upper-right corner, click Disable Real-time Log Query.

    Important

    Disabling the real-time log query feature does not automatically delete the associated project or the logs that have been shipped. To avoid incurring further charges, manually delete the automatically created project in the Simple Log Service console. For more information, see Delete a project.

Next steps

After Simple Log Service collects OSS access logs, you can query, analyze, download, ship, and transform the logs, or create alerts. For more information, see Common operations on logs from Alibaba Cloud services.