A large number of logs are generated when Object Storage Service (OSS) resources are accessed. OSS uses Simple 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
Real-time log query is enabled for an OSS bucket. For more information, see Real-time log query.
Simple Log Service is authorized to access OSS. If you have not authorized Simple Log Service to access OSS, follow the instructions on the Cloud Resource Access Authorization page to complete the authorization.
Features
Pushes logs to Simple Log Service within 3 minutes and allows you to view real-time logs in the OSS console.
Provides log analysis and common analysis reports for easy data queries.
Allows you to query and analyze raw logs in real time and filter logs by bucket, object name, API operation, or time.
Billing rules
If your Logstore uses the pay-by-feature billing mode, you are not charged log storage or index traffic fees if OSS access logs are stored for no more than 7 days and the compressed write traffic or index traffic per day is no more than 900 GB. If the size of an OSS access log is 1 KB, 900 GB is equivalent to 900 million logs. If the limits are exceeded, you are charged log storage and index traffic fees for the excess logs. The fees are included in the bills of Simple Log Service. For more information, see Billable items of pay-by-feature.
You are charged when you read data from a dedicated Logstore over the Internet. You are also charged when you transform and ship data.
If your Logstore uses the pay-by-feature billing mode, the real-time log query feature provides a free quota for shards per month. The free quota is calculated by using the following formula: 16 × 31. The unit of the free quota is shard-day. After the free quota is exhausted, you are charged fees, and the fees are included in the bills of Simple Log Service. For more information, see Billable items of pay-by-feature.
Procedure
Log on to the OSS console.
In the left-side navigation pane, click Buckets. On the Buckets page, find and click the desired bucket.
In the left-side navigation tree, choose
.On the Real-time Log Query tab, enter a query statement and an analysis statement based on the query syntax and analysis syntax to analyze the OSS logs. For more information, see Query syntax, Analysis syntax and Log fields.
For example, you can analyze the number of the
GetObject
operations on the bucket namedexamplebucket
in the past seven days based on theoperation
field of OSS access logs.Sample query statement and analysis statement:
* and __topic__: oss_access_log AND bucket:examplebucket AND operation:GetObject | select count(*) AS GetObjectCount
Sample query and analysis results:
For more information, see Examples of real-time log query.