Help Center/ Object Storage Service/ Best Practices/ Using LTS to Parse Bucket Logs
Updated on 2026-08-14 GMT+08:00

Using LTS to Parse Bucket Logs

Scenarios

When logging is enabled for a bucket, OBS automatically records all requests made to that bucket and stores the generated log files in the specified log storage bucket. These logs can then be used to troubleshoot issues or to analyze the nature, types, and trends of the requests.

This section describes how to use Log Tank Service (LTS), EventGrid (EG), and FunctionGraph to continuously report each OBS bucket log to LTS for search and analysis.

Solution Architecture

Figure 1 Architecture for using LTS to parse bucket logs

The process of using LTS to parse bucket logs is as follows:

  1. The owner of bucket A configures logging for bucket A, with bucket B specified as the log storage bucket.
  2. The bucket owner or any authorized user performs operations on bucket A, such as uploading or deleting objects.
  3. OBS records those operations on bucket A and stores the log files in bucket B.
  4. Storing log files in bucket B generates events, which are routed to the event target to trigger function execution.
  5. FunctionGraph executes the function that obtains the log files of bucket A from bucket B and sends the log files to LTS.
  6. LTS parses the log files.

Prerequisites

  • You have created buckets test-zcy-bucket-001 and test-zcy-bucket-002 in the same region. For details, see Creating a Bucket.
  • You have enabled logging for bucket test-zcy-bucket-001 and configured bucket test-zcy-bucket-002 as the log storage bucket. For details, see Configuring Logging for a Bucket.

Resource Planning

Table 1 Resource planning

Region

Resource

Resource Name

Description

Quantity

Billing

ME-Riyadh

OBS buckets

test-zcy-bucket-001

The bucket for which you configure logging

Create a bucket on OBS Console.

1

You are billed for the storage used by objects uploaded to the bucket. For details, see Storage Space.

test-zcy-bucket-002

The bucket for storing log files that record operations on bucket test-zcy-bucket-001

1

Log group

lts-group-obs-logging

Create a log group on the LTS console to manage logs.

1

In this practice, bucket log files are uploaded to LTS for parsing. The related billing items include traffic and storage. For details, see LTS Pay-per-Use Billing.

Log stream

lts-topic-obs-logging

Create a log stream on the LTS console to store and categorize logs.

1

Function

OBS_LOG_2_LTS

The function that obtains log files from the OBS bucket and uploads them to LTS for log analysis

You need to create a function on the FunctionGraph console.

1

You are billed for the number of requests, the execution duration, and the number of executions. For details, see FunctionGraph Billing Overview.

EG event subscription

OBS_LTS_Subscription

An event subscription connects an event source, a channel, and an event target. The event source (an OBS event) uses the channel to trigger the event target (the function) to run.

You need to create an EG event subscription on the event notification page of OBS Console.

1

You are billed for the number of requests. For details, see EventGrid Billing Overview.

Operation Process

Figure 2 Flowchart for using LTS to parse bucket logs

Procedure