Overview
If COS log storage is enabled, you can use the log analysis feature to further analyze the generated log files. This feature consolidates log files within a specified time range for statistical analysis and extracts key metrics for your reference.
Prerequisites
Log storage feature is enabled. If not enabled, please follow the Set Log Storage guide to enable it. Note:
The applicable regions for the COS Log Analysis Function depend on the log storage feature. Please first enable the log storage feature before using the log analysis function.
Directions
2. Choose Bucket List on the left sidebar.
3. Find the bucket that needs log analysis. Click the bucket name to go to the bucket management page.
4. On the left sidebar, select Log Management > Logging.
Note:
To use the log analysis feature, first enable log storage as instructed in Setting Logging. 5. With the log storage service enabled, the activation page for log analysis will appear. Click Use Now, and the system will detect whether you have added a COS log analysis function. A pop-up will guide you to create a COS log analysis function. For configuration instructions, please refer to Add COS Log Analysis Function. 6. Select a corresponding function and time range. Click New Analysis Task and configure the following information in the pop-up window:
Source Bucket: The default is the current bucket.
Time Range: Period of logs you want to analyze, up to 30 days. Logs are retrieved according to end time. Logs in the specified time range cannot exceed 200 GB.
Cloud Function: Select a COS log analysis function added in the region where this bucket resides.
Product Destination Directory: After analysis, the output result will be zipped and saved to the directory you set. The output file contains result file and inventory file. Result file is based on the scenario you select. Inventory file refers to the log file list retrieved for this analysis.
7. Click Next, enter the detailed configuration page. Configuration instructions are as follows.
Task Type: Supports statistical analysis and retrieval operation logs.
Statistical analysis: Perform statistical analysis in scenarios that support object download.
Search operation logs: Support search related logs by feature operations
Scene categories: Currently only support object download scenarios.
Select scene: Currently supported log analysis scenarios. For example, analyze the top N IPs and top N files with the highest download traffic, the top N IPs, top N files, top N HTTP referers, and top N UserAgents with the most download counts.
Value of N: Corresponding N value in the scenario. Enter a positive integer.
Job Description: Customize the description for this analysis.
Scene categories: Support bucket and object-related scenarios.
Select Scene
Bucket-related: Including static website-related, origin-pull settings-related, lifecycle-related, tag management-related, inventory setting-related, cross-domain configuration-related, anti-hotlinking setting-related, server encryption-related, bucket ACL-related, Policy permission setting-related, global acceleration domain name setting-related, version control-related, cross-bucket replication-related, log storage-related.
Operation Filtering: Supports filtering read and write operations.
Object-related: Supports file upload (single file upload, multi-part upload, file replication), file download, single file deletion, and batch file deletion scenarios.
Filter Condition: Supports specifying object keys (not supported for batch file deletion), UserAgent, and source IP filter conditions.
Filter Mode: Supports fuzzy matching and exact matching.
Job Description: Customize the description for this analysis.
8. After confirming that the configuration is correct, click OK, and you will see that the analysis task has been added successfully. If the configuration is incorrect, follow the prompt to complete the operation.
Click View Result to view the result of this analysis task and where the result files are saved.
Note:
You can query log analysis tasks created in the last 3 days.
You can view the result only after a log analysis task is finished. A task takes a few to tens of minutes depending on the log size.
Click Running Log to go to the SCF console and view logs of COS log analysis.