ApsaraDB for MongoDB produces audit logs, slow query logs, and operational logs. This topic describes the fields in each log type.
Audit logs
Audit logs are stored in the Logstore named mongo_audit_log_standard. The following table describes the audit log fields.
Audit logs and slow query logs share the same field names. To distinguish between the two, check the audit_type field. In slow query logs, the audit_type field is always slowop. Any other value indicates an audit log entry.
|
Field |
Description |
|
__topic__ |
The log topic. Fixed value: mongo_audit_log. |
|
audit_type |
The log type. Example: Command. When audit_type is 'command', it includes the specific commands listed in the following table. |
|
coll |
The collection name. |
|
db |
The database name. |
|
docs_examined |
The number of documents scanned. |
|
instanceid |
The ID of the ApsaraDB for MongoDB instance. |
|
keys_examined |
The number of index entries scanned. |
|
latency |
The elapsed time of the operation. |
|
optype |
The operation type. Valid values:
|
|
return_num |
The number of entries returned. |
|
thread_id |
The thread ID. |
|
time |
The timestamp. |
|
user |
The username used to log in to the ApsaraDB for MongoDB database. |
|
user_ip |
The client IP address used to access the ApsaraDB for MongoDB instance. |
Commands included when audit_type is 'command'
The following table lists the specific commands audited when audit_type is 'command', grouped by category.
|
Command category |
Specific commands |
|
Query and aggregation commands |
|
|
Index operations |
|
|
Collection and database operations |
|
|
Server information and diagnostics |
|
|
Maintenance and validation |
|
|
Replica set management |
|
|
Sharding management |
|
|
User management |
|
|
Role management |
|
|
Session management |
|
|
Transaction commands |
|
|
Authentication commands |
|
|
System administration |
|
|
Plan cache commands |
|
|
Other commands |
|
Slow query logs
Slow query logs are stored in the Logstore named mongo_slow_run_log. The following table describes the slow query log fields.
|
Field |
Description |
|
__topic__ |
The log topic. Fixed value: mongo_slow_log. |
|
audit_type |
The log type. Fixed value: slowop. |
|
coll |
The collection name. |
|
db |
The database name. |
|
docs_examined |
The number of documents scanned. |
|
instanceid |
The ID of the ApsaraDB for MongoDB instance. |
|
keys_examined |
The number of index entries scanned. |
|
latency |
The elapsed time of the operation. |
|
optype |
The operation type. Valid values:
|
|
return_num |
The number of entries returned. |
|
thread_id |
The thread ID. |
|
time |
The timestamp. Unit: seconds. |
|
user |
The username used to log in to the ApsaraDB for MongoDB database. |
|
user_ip |
The client IP address used to access the ApsaraDB for MongoDB instance. |
Operational logs
Operational logs are stored in the Logstore named mongo_slow_run_log. The following table describes the operational log fields.
|
Field |
Description |
|
__topic__ |
The log topic. Fixed value: mongo_run_log. |
|
category |
The log category. Example: NETWORK (network connection logs). |
|
connection |
The connection information. |
|
content |
The log content. |
|
instanceid |
The ID of the ApsaraDB for MongoDB instance. |
|
ip |
The IP address. |
|
level |
The log severity level. |
|
port |
The port number. |
|
time |
The timestamp of the log entry. |