When you access OSS, a large number of access logs are generated. Real-time log query combines OSS with Log Service. This feature allows you to query and collect statistics for OSS access logs and audit access to OSS by using the OSS console, track exceptions, and troubleshoot problems. Real-time log query enables you to be more efficient and make better decisions.

Prerequisites

  • Log Service is activated.

    You can activate Log Service on the Log Service product page.

  • Log Service is authorized to access OSS.

    You can go to the Cloud Resource Access Authorization page to authorize Log Service to access OSS.

  • RAM users must have sufficient permissions to configure or implement real-time log query.
    • To enable real-time log query, RAM users must have the following permissions:
      • Management permission on corresponding buckets
      • Read-only permission on RAM (AliyunRAMReadOnlyAccess)
      • Management permission on Log Service (AliyunLogFullAccess)
    • To implement real-time log query, RAM users must have the following permissions:
      • Access permission on corresponding buckets
      • Read-only permission on RAM (AliyunRAMReadOnlyAccess)
      • Read-only permission on Log Service (AliyunLogReadOnlyAccess)

Background information

  • Real-time log query allows you to query logs from the past seven days free of charge. If the log storage time that you set is longer than seven days, Log Service will charge the excess days separately. Extra fees are charged when you read data from or write data to Log Service over the Internet.
  • Log Service allows you to store 900 GB of logs (equivalent to 900 million 1-KB log entries) per day free of charge, and charges additional fees for excessive logs. You can use the real-time log query feature to query the stored logs.

For more information about the billing standards, see Log Service Billing methods.

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.
  3. In the Create Bucket dialog box that appears, set Real-time Log Query to Enable.
    For more information about the configurations of other parameters, see Create buckets.
  4. Click OK.

Method 2: Enable real-time log query in the overview page of a bucket

  1. Log on to the OSS console.
  2. Click Buckets, and then click the name of the target bucket.
  3. Choose Logging > Real-time Log Query.
  4. Click Activate Now.

Real-time log query allows you to query logs from the past seven days free of charge. You can click Config Log Retention Time 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. Click Buckets, and then click the name of the target bucket.
  3. 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 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. Click Buckets, and then click the name of the target bucket.
  3. Choose Logging > Real-time Log Query.
  4. Click Dashboard to analyze logs.
    Dashboard allows you to view four immediately available reports.
    • Access Center: displays the overall operating status including the PV, UV, traffic, and distribution of access over the Internet.
    • Audit Center: displays statistics on object operations including read, write, and delete operations on objects.
    • 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

You can view OSS access logs in the Log Service console. For more information, see OSS access logs.

References