Download audit logs from an ApsaraDB for MongoDB instance to archive, filter, and analyze them locally.
Prerequisites
Before you begin, ensure that you have:
The audit log feature enabled. For more information, see Enable the audit log feature.
Download audit logs from a chart
Use this method to download a filtered subset of audit log data from a specific chart.
Go to the Replica Set Instances or Sharded Cluster Instances page. In the top navigation bar, select the region where the instance resides. Find the instance and click its ID.
In the left-side navigation pane, choose Data Security > Audit Logs.
(Optional) Filter log entries before downloading:
By keyword, operation type, or client IP address: See View audit logs.
By time range: Click the More icon in the upper-right corner of the chart and select Select Time Range.
Click the More icon in the upper-right corner of the chart and select a download option:
Option Output format Open with Download Chart Data .csvExcel or a similar spreadsheet tool Download Chart .pngMicrosoft Paint or a similar image viewer
Download all audit logs
Choose a download method based on the total number of log entries.
Up to 2,000 log entries
Go to the Replica Set Instances or Sharded Cluster Instances page. In the top navigation bar, select the region where the instance resides. Find the instance and click its ID.
In the left-side navigation pane, choose Data Security > Audit Logs.
(Optional) Click the More icon in the upper-right corner of the Audit Log Details section and select Select Time Range to narrow the results.
Click the More icon in the upper-right corner of the Audit Log Details section and select Download Chart Data. The log entries download as a
.csvfile that you can open with Excel or a similar tool.
More than 2,000 log entries
Download audit logs directly from the Log Service (SLS) console. For instructions, see Download logs.
When configuring the download in the Log Service console, use the following settings:
| Setting | Value |
|---|---|
| Logstore | mongodb_audit_log_standard |
| Project name | nosql-{Alibaba Cloud account ID}-{Region} (example: nosql-17649847257****-cn-hangzhou) |
| Download method | Download All Logs with Cloud Shell or Download All Logs Using Command Line Tool |
Do not select Download Log in Current Page, which downloads only the logs visible on the current page.