Updated on 2024-03-22 GMT+08:00

Collecting Logs from DDS

LTS can collect logs from Document Database Service (DDS). For details, see Log Reporting.

Structuring Template Details of DDS Slow Query Logs

  • DDS slow query log example
    Table 1 Structuring template example

    Template Name

    Example Log

    DDS slow query logs

    {"log_type": "slow_log","log_time": "2022-08-20T10:04:03.204000Z","namespace": "data0820.table","database": "data0820","collection": "table","operate_type": "insert","docs_scanned": 0,"docs_returned": 0,"n_deleted": 0,"n_matched": 0,"n_modified": 0,"n_inserted": 10,"cost_time": 555,"lock_time": 0,"whole_message": "{\"op\": \"insert\", \"ns\": \"data0820.usrtable\", \"command\": \"{N}\", \"ninserted\": 1, \"keysInserted\": 1, \"numYield\": 0, \"locks\": {\"Global\": {\"acquireCount\": {\"r\": 5, \"w\": 5}}, \"Database\": {\"acquireCount\": {\"w\": 4, \"W\": 1}}, \"Collection\": {\"acquireCount\": {\"w\": 2}}, \"oplog\": {\"acquireCount\": {\"w\": 2}}}, \"responseLength\": 230, \"protocol\": \"op_msg\", \"millis\": 555, \"ts\": {\"$date\": 1660989843204}, \"client\": \"192.168.0.64\", \"appName\": \"MongoDB Shell\", \"allUsers\": [{\"user\": \"rwuser\", \"db\": \"admin\"}], \"user\": \"rwuser@admin\"}","instance_id": "5b67dc63ba824145aae1f12ff51e58b8in02","node_id": "686a791e690e4db3af591ec4b6f72916no02","client_ip": "190.12.11.11","username": "user English","keys_examined": 0}
  • Structuring fields and description
    Table 2 Structuring fields

    Field

    Example

    Description

    Type

    log_type

    slow_log

    Log type

    string

    log_time

    2022-08-20T10:04:03.204000Z

    Time when a slow query log is generated

    string

    namespace

    data0820.table

    Namespace

    string

    database

    data0820

    Database name

    string

    collection

    table

    Table name

    string

    operate_type

    insert

    Operation type

    string

    docs_scanned

    0

    Number of scanned rows in the database

    long

    docs_returned

    0

    Number of rows in the query result

    long

    n_deleted

    0

    Number of deleted rows

    long

    n_matched

    0

    Number of matched rows updated

    long

    n_modified

    0

    Actual updated rows

    long

    n_inserted

    10

    Inserted rows

    long

    cost_time

    555

    Time spent on the operation

    long

    lock_time

    0

    wait_lock time

    long

    whole_message

    {\"op\": \"insert\", \"ns\": \"data0820.usrtable\", \"command\": \"{N}\", \"ninserted\": 1, \"keysInserted\": 1, \"numYield\": 0, \"locks\": {\"Global\": {\"acquireCount\": {\"r\": 5, \"w\": 5}}, \"Database\": {\"acquireCount\": {\"w\": 4, \"W\": 1}}, \"Collection\": {\"acquireCount\": {\"w\": 2}}, \"oplog\": {\"acquireCount\": {\"w\": 2}}}, \"responseLength\": 230, \"protocol\": \"op_msg\", \"millis\": 555, \"ts\": {\"$date\": 1660989843204}, \"client\": \"192.168.0.64\", \"appName\": \"MongoDB Shell\", \"allUsers\": [{\"user\": \"rwuser\", \"db\": \"admin\"}], \"user\": \"rwuser@admin\"}

    Original log information

    string

    instance_id

    5b67dc63ba824145aae1f12ff51e58b8in02

    Instance ID

    string

    node_id

    686a791e690e4db3af591ec4b6f72916no02

    Node ID

    string

Structuring Template Details of DDS Error Logs

  • DDS error log example
    Table 3 Structuring template example

    Template Name

    Example Log

    DDS error logs

    {"log_type": "error_log","severity": "Error","log_time": "2022-08-22T09:33:15.142+0000","raw_message": "E QUERY    [ClusterDisasterBackupChangeJob] Get global setting disasterBackup failed.","instance_id": "5b67dc63ba824145aae1f12ff51e58b8in02","node_id": "686a791e690e4db3af591ec4b6f72916no02"}
  • Structuring fields and description
    Table 4 Structuring fields

    Field

    Example

    Description

    Type

    log_type

    error_log

    Log type

    string

    severity

    Error

    Log level

    string

    log_time

    2022-08-22T09:33:15.142+0000

    Time when a log was generated

    string

    raw_message

    E QUERY [ClusterDisasterBackupChangeJob] Get global setting disasterBackup failed.

    Log content

    string

    instance_id

    5b67dc63ba824145aae1f12ff51e58b8in02

    Instance ID

    string

    node_id

    686a791e690e4db3af591ec4b6f72916no02

    Node ID

    string

Structuring Template Details of DDS Audit Logs

  • DDS audit log example
    Table 5 Structuring template example

    Template Name

    Example Log

    DDS audit logs

    {"topic":"auditLog","instanceid":"9fbf813bc27e4a3ab54bddf783a4f774in01","nodeid":"bf4cb0413d0b4221be94b08471708586no01","db":"test","coll":"testCollection","optype":"update","time":"2022-08-05T08:24:15.536+0000","user_ip":"10.4.23.205","user_port":"47668","user":"rw_testuser","param":{"command":"update","ns":"test.testCollection","op":[{"q":{"vin":"LDP31B965NG036174"},"u":{"$set":{"timestamp":{"$numberLong":"1659687855535"},"deviceTime":{"$numberLong":"1659687855340"},"longitude":"119.35516805555555","latitude":"26.057936388888891","location":"119.35516805555555,26.057936388888891","height":"10.097286797128618","direction":"12","speed":14,"accuracy":"0","h3Address7":"8741b5300ffffff"}},"upsert":true}],"args":{"update":"testCollection","ordered":true,"$db":"test","$clusterTime":{"clusterTime":{"$timestamp":{"t":1659687855,"i":1685}},"signature":{"hash":{"$binary":"CP5bfEf+gBJZdAxCKtF9HiSeqQY=","$type":"00"},"keyId":{"$numberLong":"7102408879899674942"}}},"lsid":{"id":{"$binary":"PXVVrbuvRuGkypCbu/oXXQ==","$type":"04"}}}}}
  • Structuring fields and description
    Table 6 Structuring fields

    Field

    Example

    Description

    Type

    topic

    auditLog

    Message topic

    string

    instanceid

    9fbf813bc27e4a3ab54bddf783a4f774in01

    Instance ID

    string

    nodeid

    bf4cb0413d0b4221be94b08471708586no01

    Node ID

    string

    db

    test

    Database name

    string

    coll

    testCollection

    Name of the collection for which sharding is enabled

    string

    optype

    update

    Operation type

    string

    time

    2022-08-05T08:24:15.536+0000

    Audit log time

    string

    user_ip

    10.4.23.205

    Client IP

    string

    user_port

    47668

    Client port

    string

    user

    rw_testuser

    Database user account

    string

    param

    {\"command\":\"update\",\"ns\":\"test.testCollection\",\"op\":[{\"q\":{\"vin\":\"LDP31B965NG036174\"},\"u\":{\"$set\":{\"timestamp\":{\"$numberLong\":\"1659687855535\"},\"deviceTime\":{\"$numberLong\":\"1659687855340\"},\"longitude\":\"119.35516805555555\",\"latitude\":\"26.057936388888891\",\"location\":\"119.35516805555555,26.057936388888891\",\"height\":\"10.097286797128618\",\"direction\":\"12\",\"speed\":14,\"accuracy\":\"0\",\"h3Address7\":\"8741b5300ffffff\"}},\"upsert\":true}],\"args\":{\"update\":\"testCollection\",\"ordered\":true,\"$db\":\"test\",\"$clusterTime\":{\"clusterTime\":{\"$timestamp\":{\"t\":1659687855,\"i\":1685}},\"signature\":{\"hash\":{\"$binary\":\"CP5bfEf+gBJZdAxCKtF9HiSeqQY=\",\"$type\":\"00\"},\"keyId\":{\"$numberLong\":\"7102408879899674942\"}}},\"lsid\":{\"id\":{\"$binary\":\"PXVVrbuvRuGkypCbu/oXXQ==\",\"$type\":\"04\"}}}}

    Database operation details and parameters

    string