A large number of logs are generated when OSS resources are accessed. OSS uses Log Service to help you query and collect statistics for OSS access logs and audit access to OSS in the OSS console, track exception events, and troubleshoot problems. This helps you improve work efficiency and make informed decisions.

Prerequisites

  • Log Service is activated.

    If you have not activated Log Service, go to the Log Service product page.

  • Log Service is authorized to access OSS.

    If you have not authorized Log Service to access OSS, visit Cloud Resource Access Authorization and follow the instructions to complete the authorization.

Benefits

  • Pushes logs to Log Service within three minutes and allows you to view real-time logs in the OSS console.
  • Provides log analysis and common analysis reports so that you can easily query data.
  • Allows you to query and analyze raw logs in real time and filter logs by bucket, object name, API operation, or time.

Billing

When you use the real-time log feature, fees are generated if the following conditions occur:

  • Real-time log query allows you to query logs over the last seven days free of charge. If the log retention time that you set is longer than seven days, you are charged for the excess days.
  • Log Service allows you to store 900 GB of logs (equivalent to 900 million 1-KB log entries) per day free of charge. You are charged for the excess logs.
  • You are charged for traffic consumed when you read data from or write data to Log Service over the Internet.

For more information about the billing standards, see Pay-as-you-go.

Enable real-time log query

You can use one of the following methods to enable real-time log query:

  • Method 1: Enable real-time log query when you create a bucket

    1. Log on to the OSS console.
    2. On the Overview page, click Create Bucket on the right side.
    3. In the Create Bucket dialog box, set Real-time Log Query to Enable. For more information about other parameters, see Create buckets.
    4. Click OK.
  • Method 2: Enable real-time log 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, click the name of the bucket for which you want to enable real-time log query.
    3. In the left-side navigation pane, choose Logging > Real-time Log Query.
    4. Click Activate Now.

Real-time log query allows you to query logs over the last seven days free of charge. You can click Config Log Retention Time in the upper-right corner to modify the retention time of logs.

Query real-time logs

You can use one of the following methods to query real-time logs:

  • Method 1: Query real-time logs on the Original Log page

    1. Log on to the OSS console.
    2. In the left-side navigation pane, click Buckets. On the Buckets page, click the name of the bucket whose logs you want to query.
    3. In the left-side navigation pane, choose Logging > Real-time Log Query.
    4. Click Original Log to analyze logs.
      You can specify the time range and query statement in real-time log queries. For example, you can analyze the distribution of a specified field such as an API operation within a specified time range. You can also filter the query results by conditions to view required access records.
  • Method 2: Query real-time logs on the Dashboard page

    1. Log on to the OSS console.
    2. In the left-side navigation pane, click Buckets. On the Buckets page, click the name of the bucket whose logs you want to query.
    3. In the left-side navigation pane, choose Logging > Real-time Log Query.
    4. Click Dashboard to analyze logs.
      Dashboard allows you to view the following types of reports:
      • Access Center: displays the overall operating status including the PV, UV, traffic, and access distribution over the Internet.
      • Audit Center: displays statistics on object operations including read, write, and delete operations.
      • Operation Center: displays statistics on access logs including the number of requests and distribution of failed operations.
      • Performance Center: displays statistics on performance including the performance of downloads and uploads over the Internet, the performance of transmission over different networks or with different object sizes, and the list of differences between stored and downloaded objects.
  • Method 3: Query real-time logs in the Log Service console

    Log on to the Log Service console to query real-time OSS logs. For more information, see OSS access logs.

Disable real-time log query

If you no longer need to retain log data, perform the following steps to disable real-time log query:

  1. Log on to the OSS console.
  2. In the left-side navigation pane, click Buckets. On the Buckets page, click the name of the bucket whose logs you want to disable.
  3. Choose Logging > Real-time Log Query.
  4. Click Disable Real-time Log Query in the upper-right corner.
    Notice When you enable real-time log query, Log Service projects are automatically created. However, the projects are not automatically deleted when you disable real-time log query. Therefore, after real-time log query is disabled, you must log on to the Log Service console to delete the projects that are automatically created to avoid unexpected charges. For more information, see Delete a project.