UiPath Documentation
automation-suite
2022.4
false
Automation Suite インストール ガイド
重要 :
このコンテンツの一部は機械翻訳によって処理されており、完全な翻訳を保証するものではありません。 新しいコンテンツの翻訳は、およそ 1 ~ 2 週間で公開されます。

監査ログのクエリ

前提条件​

Automation Suite のセットアップで Apps の監査ログをダウンロードする前に、以下の要件を満たす必要があります。

  • UiPath® サービスがホストされているマシンまたは仮想マシン (VM) へのアクセス権があること。

必要に応じて、以下の情報を把握しておく必要があります。

  • 監査ログが必要な組織名 (<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 という名前の組織の sampleOrg.admin@org.com というユーザー メールで、180 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 という名前の組織の sampleOrg.admin@org.com というユーザー メールで、180 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. 次のコマンドを使用して root ユーザーに切り替えます。

    sudo su
    sudo su
    
  4. 次のコマンドを使用して root フォルダーに移動します。

    cd /
    cd /
    
  5. 次のコマンドを使用して KUBECONFIG をエクスポートします。

    export KUBECONFIG=/etc/rancher/rke2/rke2.yaml PATH=$PATH:/var/lib/rancher/rke2/bin
    export 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 commands
    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 commands
    

  7. 次のコマンドを使用して Mongo レプリカ セットのシェルに移動します。

    kubectl -n mongodb exec -it mongodb-replica-set-0 bash
    kubectl -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()
    EOF
    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()
    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>)}})
    EOF
    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>)}})
    EOF
    
  10. 次のコマンドを使用してポッド シェルを終了します。

    exit
    exit
    
  11. 以下のコマンドを使用してポッドから仮想マシンにファイルを移動します。

    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.json
    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.json
    
  12. 次のコマンドを使用して仮想マシンを終了します。

    // exit the root user
    exit
    // exit the vm
    exit
    // exit the root user
    exit
    // exit the vm
    exit
    
  13. 以下のコマンドを使用して仮想マシンから個人のマシンにファイルを移動します。

    注:

    SCP might not run on some PowerShells and may need to be installed.

    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>
    

このページは役に立ちましたか?

接続

ヘルプ リソース サポート

学習する UiPath アカデミー

質問する UiPath フォーラム

最新情報を取得