You can use Log Service in the OSS console to analyze a large number of logs. This topic describes how to activate and use Log Service in the OSS console.

Background information

OSS users often need to analyze access logs and resource consumption data. Examples:
  • OSS bucket usage, traffic usage, and requests
  • Logs generated during the object lifecycle when objects are created, modified, and deleted
  • Frequently accessed objects and object access statistics including visits and generated traffic
  • Logs of requests for which errors are returned and error content

We recommend that you use real-time log query to analyze OSS access logs of the last seven days free of charge.

Note

Log Service is a paid service. For more information about billing, see Log Service Pricing.

Activate Log Service

  1. Log on to the OSS console.
  2. ChooseRecommended Services > More Service.
  3. Find Log Service. Move the pointer over this icon and click Activate.
  4. On the Enable Service page, read and select I agree with Log Service Agreement of Service, and click Enable Now.

Associate a bucket with Log Service

  1. Log on to the OSS console.
  2. ChooseRecommended Services > More Service.
  3. Find Log Service. Move the pointer over this icon and click Configure.
  4. On the Log Service page that appears, click Associate.
  5. In the Associate Bucket with Logstore dialog box that appears, associate a bucket with Log Service.
    1. In step 1, set Region, Project Name, and Description (optional).
      • When you set Region, select the region where available buckets are located.
      • When you set Project Name, ensure that the name meets the following conventions:
        • The project name can contain only lowercase letters, digits, and hyphens (-).
        • The project name must start and end with a lowercase letter or a digit.
        • The project name must be 3 to 63 characters in length.
    2. Click Next.
    3. In step 2, set Logstore Name, Data Lifecycle (Days), and Shards.
      If you have configured a Logstore, click Choose Logstore and select the Logstore that you want to associate with the bucket.
      • Logstore Name: Specify the name of the Logstore.
        • The Logstore name can contain only lowercase letters, digits, hyphens (-), and underscores (_).
        • The Logstore name must start and end with a lowercase letter or digit.
        • The Logstore name must be 3 to 63 characters in length.
      • Data Lifecycle (Days): Set the period in days for which to retain data.
      • Shards: Set the number of shards. For more information, see Shards.
    4. Click Next.
    5. In step 3, set Associate Buckets and click Submit.

Configure index information

  1. Click Configure Index.
  2. Log Service provides several preset indexes for querying OSS access logs. For more information about the related fields, see Log fields.
    1. Find the target project and click the project name.
    2. Double-click the Logstore name and choose Index Attributes > Modify.
      Configure indexes
      Note By default, Log Service creates four dashboards for the Logstore associated with one or more buckets. After you complete the configuration, you can view these dashboards on the Dashboard page. You can also click Analyze Log next to a target Logstore on the Log Service page in the OSS console, and click a dashboard name in the left-side navigation pane to view the dashboard.

Analyze logs

  1. Log on to the OSS console.
  2. ChooseRecommended Services > More Service.
  3. Move the pointer over the Log Service icon and click Configure.
  4. On the Log Service page that appears, click Analyze Log in the Actions column corresponding to the project that you want to use to analyze logs.
  5. On the log analysis page that appears, you can view the log analysis results either in Logstores or in the dashboard.