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, track exception events, and troubleshoot problems in the OSS console. This helps you improve efficiency and make informed decisions.
Prerequisites
Real-time log query is enabled for the 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 for reading data from a dedicated Logstore, processing log data, and delivering log data. These charges are included in your Simple Log Service bills.
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 log fields.
For example, you can analyze the
operation
log field to monitor the number of theGetObject
operations on the bucket namedexamplebucket
in the past seven days.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 Common examples of real-time log query.