Automation Suite
2022.4
False
横幅背景图像
Automation Suite 安装指南
上次更新日期 2024年4月24日

审核日志查询

先决条件

在 Automation Suite 设置中下载 Apps 的审核日志之前,必须满足以下要求:

  • You must have access to the machine or virtual machine (VM) where UiPath® services are hosted.

(可选)您需要了解以下内容:

  • 需要审核日志的组织名称 (<orgName>)。
  • 需要导出或删除审核日志的用户电子邮件地址 (<userEmail>)。
  • 从现在到您要获取或删除审核日志的日期 (<numDays>) 之间的天数。

获取审核日志查询

db.getCollection("audit-logs").find({
    __tenantId: '<orgName>',
    'userInfo.userEmail': '<userEmail>',
    timestamp: {
        $lte: (new Date().getTime() - 86400000 * <numDays>)
    }
});db.getCollection("audit-logs").find({
    __tenantId: '<orgName>',
    'userInfo.userEmail': '<userEmail>',
    timestamp: {
        $lte: (new Date().getTime() - 86400000 * <numDays>)
    }
});
例如,要获取用户电子邮件地址为 sampleOrg.admin@org.com,组织名称为 sampleOrg180 days 以上的审核日志,请运行以下查询:
db.getCollection("audit-logs").find({
    __tenantId: 'sampleOrg',
    'userInfo.userEmail': 'sampleOrg.admin@org.com',
    timestamp: {
        $lt: (new Date().getTime() - 86400000 * 180)
    }
});db.getCollection("audit-logs").find({
    __tenantId: 'sampleOrg',
    'userInfo.userEmail': 'sampleOrg.admin@org.com',
    timestamp: {
        $lt: (new Date().getTime() - 86400000 * 180)
    }
});

删除审核日志

db.getCollection("audit-logs").deleteMany({
    __tenantId: '<orgName>',
    'userInfo.userEmail': '<userEmail>',
    timestamp: {
        $lte: (new Date().getTime() - 86400000 * <numDays>)
    }
});db.getCollection("audit-logs").deleteMany({
    __tenantId: '<orgName>',
    'userInfo.userEmail': '<userEmail>',
    timestamp: {
        $lte: (new Date().getTime() - 86400000 * <numDays>)
    }
});
例如,要删除用户电子邮件地址为 sampleOrg.admin@org.com,组织名称为 sampleOrg180 days 以上的审核日志,请运行以下查询:
db.getCollection("audit-logs").deleteMany({
    __tenantId: 'sampleOrg',
    'userInfo.userEmail': 'sampleOrg.admin@org.com',
    timestamp: {
        $lt: (new Date().getTime() - 86400000 * 180)
    }
});db.getCollection("audit-logs").deleteMany({
    __tenantId: 'sampleOrg',
    'userInfo.userEmail': 'sampleOrg.admin@org.com',
    timestamp: {
        $lt: (new Date().getTime() - 86400000 * 180)
    }
});

程序

  1. 打开命令提示符或 Powershell。
  2. 使用以下命令通过 SSH 连接到虚拟机。
    ssh <user>@<host>
    user@host's password: <password>ssh <user>@<host>
    user@host's password: <password>
  3. 使用以下命令转到根用户。
    sudo susudo su
  4. 使用以下命令转到根文件夹。
    cd /cd /
  5. 使用以下命令导出 KUBECONFIG。
    export KUBECONFIG=/etc/rancher/rke2/rke2.yaml PATH=$PATH:/var/lib/rancher/rke2/binexport KUBECONFIG=/etc/rancher/rke2/rke2.yaml PATH=$PATH:/var/lib/rancher/rke2/bin
  6. 使用以下命令获取 MongoDB URI。
    kubectl -n mongodb get secrets/mongo-admin-user --template={{.data.MONGODB_URI}} | base64 -d
    // copy and store the output till '/admin' (as highlighted in screenshot) for further use in next commandskubectl -n mongodb get secrets/mongo-admin-user --template={{.data.MONGODB_URI}} | base64 -d
    // copy and store the output till '/admin' (as highlighted in screenshot) for further use in next commands


  7. 使用以下命令转到 Mongo 副本集的 Shell。
    kubectl -n mongodb exec -it mongodb-replica-set-0 bashkubectl -n mongodb exec -it mongodb-replica-set-0 bash
  8. 使用以下命令检索审核记录。
    mongo '<mongodb-uri>' --tls --tlsCAFile /var/lib/tls/ca/ca.crt --quiet << EOF > /data/audit-fetch-query.json
    use appstudio
    db.getCollection("audit-logs").find({"__tenantId": "<orgName>", "userInfo.userEmail": "<userEmail>", "timestamp": {\$lte: (new Date().getTime() - 86400000 * <numDays>)}}).toArray()
    EOFmongo '<mongodb-uri>' --tls --tlsCAFile /var/lib/tls/ca/ca.crt --quiet << EOF > /data/audit-fetch-query.json
    use appstudio
    db.getCollection("audit-logs").find({"__tenantId": "<orgName>", "userInfo.userEmail": "<userEmail>", "timestamp": {\$lte: (new Date().getTime() - 86400000 * <numDays>)}}).toArray()
    EOF
  9. 使用以下命令删除审核记录。
    mongo '<mongodb-uri>' --tls --tlsCAFile /var/lib/tls/ca/ca.crt --quiet << EOF > /data/audit-delete-query.json
    use appstudio
    db.getCollection("audit-logs").deleteMany({"__tenantId": "<orgName>", "userInfo.userEmail": "<userEmail>", "timestamp": {\$lte: (new Date().getTime() - 86400000 * <numDays>)}})          
    EOFmongo '<mongodb-uri>' --tls --tlsCAFile /var/lib/tls/ca/ca.crt --quiet << EOF > /data/audit-delete-query.json
    use appstudio
    db.getCollection("audit-logs").deleteMany({"__tenantId": "<orgName>", "userInfo.userEmail": "<userEmail>", "timestamp": {\$lte: (new Date().getTime() - 86400000 * <numDays>)}})          
    EOF
  10. 使用以下命令退出 Pod Shell。
    exitexit
  11. 使用以下命令将 Pod 中的文件移至虚拟机。
    kubectl -n mongodb exec -i mongodb-replica-set-0 -- sh -c 'cat /data/audit-fetch-query.json' > audit-fetch-query.json
    kubectl -n mongodb exec -i mongodb-replica-set-0 -- sh -c 'cat /data/audit-delete-query.json' > audit-delete-query.jsonkubectl -n mongodb exec -i mongodb-replica-set-0 -- sh -c 'cat /data/audit-fetch-query.json' > audit-fetch-query.json
    kubectl -n mongodb exec -i mongodb-replica-set-0 -- sh -c 'cat /data/audit-delete-query.json' > audit-delete-query.json
  12. 使用以下命令退出虚拟机。
    // exit the root user
    exit
    // exit the vm
    exit// exit the root user
    exit
    // exit the vm
    exit
  13. 使用以下命令将虚拟机中的文件移至个人计算机。
    注意:某些 PowerShell 可能无法运行 SCP,因此可能需要安装。
    scp <user>@<host>:/audit-fetch-query.json .
    user@host's password: <password>
    
    scp <user>@<host>:/audit-delete-query.json .
    user@host's password: <password>scp <user>@<host>:/audit-fetch-query.json .
    user@host's password: <password>
    
    scp <user>@<host>:/audit-delete-query.json .
    user@host's password: <password>
  • 先决条件
  • 获取审核日志查询
  • 删除审核日志
  • 程序

此页面是否有帮助?

获取您需要的帮助
了解 RPA - 自动化课程
UiPath Community 论坛
Uipath 白色徽标
信任与安全
© 2005-2024 UiPath. All rights reserved.