MongoDB logs include audit logs, slow query logs, and operational logs. This topic describes the fields in these logs.
Audit logs
Audit logs are stored in the Logstore named mongo_audit_log. The following table describes the fields of audit logs.
The names of fields in audit logs and slow query logs are the same. You can distinguish the two types of logs based on the value of the audit_type field. The value of the audit_type field in slow query logs is slowop. If the value of this field in a log entry is not slowop, this log entry is an audit log entry.
Field | Description |
__topic__ | The topic of a log entry. The value of this field is mongo_audit_log. |
audit_type | The type of a log entry, for example, Command. |
coll | The dataset. |
db | The database name. |
docs_examined | The number of scanned rows. |
instanceid | The ID of an ApsaraDB for MongoDB instance. |
keys_examined | The number of rows of scanned indexes. |
latency | The response latency. |
optype | The operation type. Valid values:
|
return_num | The number of entries returned. |
thread_id | The thread ID. |
time | The timestamp. |
user | The account that is used to log on to the ApsaraDB for MongoDB database. |
user_ip | The IP address of the client used to access the ApsaraDB for MongoDB instance. |
Slow query logs
Slow query logs are stored in the Logstore named mongo_slow_run_log. The following table describes the fields in slow query logs.
Field | Description |
__topic__ | The topic of a log entry. The value of this field is mongo_slow_log. |
audit_type | The type of a log entry. The value of this field is slowop. |
coll | The dataset. |
db | The database name. |
docs_examined | The number of scanned rows. |
instanceid | The ID of the ApsaraDB for MongoDB instance. |
keys_examined | The number of rows of scanned indexes. |
latency | The response latency. |
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 account that is used to log on to the ApsaraDB for MongoDB database. |
user_ip | The IP address of the client 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 fields in operational logs.
Field | Description |
__topic__ | The topic of a log entry. The value of the field is mongo_run_log. |
category | The type of a log entry, for example, NETWORK logs. |
connection | The log connection information. |
content | The log content. |
instanceid | The ID of the ApsaraDB for MongoDB instance. |
ip | The IP address. |
level | The severity of a log entry. |
port | The port number. |
time | The time when a log entry was generated. |