Before you query and analyze logs, you must enable the real-time log query feature. This topic describes how to enable this feature for OSS access logs in the OSS console.
Prerequisites
-
You have an OSS bucket. For more information, see Create buckets.
Make sure that the Simple Log Service project and the OSS bucket are in the same Alibaba Cloud account and region.
-
You have authorized Simple Log Service to assume the AliyunLogImportOSSRole RAM role to access OSS.
Click Cloud Resource Access Authorization and follow the on-screen instructions to complete the authorization. This is a one-time action that must be performed by an Alibaba Cloud account.
WarningDo not revoke the authorization or delete the RAM role. Otherwise, OSS access logs cannot be shipped to Simple Log Service.
Procedure
If you use a RAM user to enable the real-time log query feature, you must first grant the RAM user the required permissions. For more information, see Authorize a RAM user.
Enable real-time query when creating a bucket
Log on to the OSS console.
-
Click Buckets, and then click Create Bucket.
-
In the Create Bucket panel, turn on the Real-time Log Query switch.
For information about other parameters, see Create buckets.
-
Click OK.
Enable real-time query for an existing bucket
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 pane, choose .
-
Click Enable Now.
Related operations
If you no longer need the real-time log query feature, follow these steps to disable it.
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 pane, choose .
-
In the upper-right corner, click Disable Real-time Log Query.
ImportantDisabling the real-time log query feature does not automatically delete the associated project or the logs that have been shipped. To avoid incurring further charges, manually delete the automatically created project in the Simple Log Service console. For more information, see Delete a project.
Next steps
After Simple Log Service collects OSS access logs, you can query, analyze, download, ship, and transform the logs, or create alerts. For more information, see Common operations on logs from Alibaba Cloud services.