automation-cloud
latest
false
重要 :
请注意,此内容已使用机器翻译进行了部分本地化。 新发布内容的本地化可能需要 1-2 周的时间才能完成。
UiPath logo, featuring letters U and I in white

Automation Cloud 管理员指南

上次更新日期 2025年12月18日

导出日志

“企业标签”图片仅当您订阅企业版许可计划时,才可以使用此功能。

通过统一日志记录体验,您可以使用以下方法之一从Automation Cloud TM以 CSV 格式导出日志:
  • 用户界面中的“导出”选项:在组织或租户的“审核日志”部分中,选择“导出”
  • 审核日志 API :使用审核日志 API。
  • UiPath 自定义脚本:运行 UiPath 开发的脚本以从 UiPath 的长期审核日志存储中导出日志。

出于长期保留或合规性目的,统一日志记录体验和传统日志记录体验都允许您配置机器人日志导出,以自动将数据从 Orchestrator 发送到 Azure Blob 存储、AWS S3 或 Google Cloud Storage,这些文件每小时生成一次,并且可以通过使用您自己的 BI 或监控解决方案进行处理。

使用脚本导出日志

如果您使用的是统一日志记录体验,则可以使用专用脚本来导出无法再通过“审核日志”界面使用的审核日志。该脚本支持检索 2 年前的日志。

在以下情况下,此脚本很有用:

  • 出于合规性或调查目的,您需要访问较旧的审核日志。

  • 您想要自动执行长期日志存档。

先决条件

  1. 将以下脚本复制到您自己的.sh文件中:
    appId=$1
    appSecret=$2
    organizatioNameOrId=$3
    fromDate=$4
    toDate=$5
    mode=${6:-s}
    cloud=${7:-cloud}
    
    if [[ $# -lt 5 ]]; then
      echo "Error: Not all required input parameters provided."
      echo "Usage: $0 <appId> <appSecret> <organizatioNameOrId> <fromDate> <toDate> <mode>(optional: v for verbose, s for silent)"
      exit 1
    fi
    
    # Validate "fromDate" date format (MM/DD/YYYY)
    if ! date -d "$fromDate" &>/dev/null; then
      echo "Error: Invalid date format for 'fromDate'. Please use MM/DD/YYYY format."
      exit 1 
    fi
    
    # Validate "to" date format (MM/DD/YYYY)
    if ! date -d "$toDate" &>/dev/null; then
      echo "Error: Invalid date format for 'toDate'. Please use MM/DD/YYYY format."
      exit 1
    fi
    
    echo $(date +"%Y-%m-%d %H:%M:%S.%3N") "Start Getting UiPath Token."
    response=$(curl --data-urlencode -X POST "https://${cloud}.uipath.com/${organizationNameOrId}/identity_/connect/token" -$mode \
                -d "grant_type=client_credentials" \
                -d "scope=PM.Audit.Read" \
                -d "client_id=$appId" \
                -d "client_secret=$appSecret" \
                -H "Content-Type: application/x-www-form-urlencoded")
    
    access_token=$(echo "$response" | jq -r '.access_token')
    
    if [[ "$access_token" == null ]]; then
      echo "Error: Access token is null or empty in the response. Please verify the appId and appSecret."
      exit 1
    fi
    
    base_dir=$(date +"%Y-%m-%d%H:%M:%S.%3N")
    echo $base_dir "Start Downloading UiPath Platform Audit logs."
    # Define the base URL
    base_url="https://${cloud}.uipath.com/${organizatioNameOrId}/orgaudit_/api/query/downloadeventsfromlongtermstore"
    
    mkdir -p $base_dir
    # Iterate through time intervals
    current_date=$(date -u -d "$fromDate" +"%Y-%m-%dT%H:%M:%SZ")
    seconds_in_a_day=$((24*60*60))
    while [ "$(date -d "$current_date" +%s)" -le "$(date -d "$toDate" +%s)" ]; do
      next_date=$(date -u -d "$current_date + $(($seconds_in_a_day-1)) seconds" +"%Y-%m-%dT%H:%M:%SZ")
      
      # Construct the full URL with the current time interval
      formatted_current_date=$(date -u -d "$current_date" +"%Y-%m-%dT%H:%M:%SZ" | sed 's/\//%2F/g')
      formatted_current_date="${current_date}"
      formatted_next_date=$next_date | sed 's/\//%2F/g'
      formatted_next_date="${next_date}"
      full_url="$base_url?from=$formatted_current_date&to=$formatted_next_date"
    
      echo $full_url
    
      echo "Downloading UiPath Audit Log from $current_date to $next_date"
      curl -X GET "$full_url" -$mode \
           -H "Authorization: Bearer $access_token" \
           -o "${base_dir}/${current_date////-}_to_${next_date////-}.zip"  # Save the response to a file
      
      # Move to the next time interval
      current_date=$next_date
      one=1
      current_date=$(date -u -d "$current_date + $one seconds" +"%Y-%m-%dT%H:%M:%SZ")
    done
    
    for zip_file in "$base_dir"/*.zip; do
      zip_file_name="$(basename "$zip_file")"
      unzip -q "$zip_file" -d "$base_dir/auditlogs/"
      echo "Extracted ${zip_file_name%.*}"
      rm "$zip_file"
    done
    
    shopt -s nullglob
    for zip_file in "$base_dir/auditlogs"/*.zip; do
      zip_file_name="$(basename "$zip_file")"
      unzip -q "$zip_file" -d "$base_dir/auditlogs/${zip_file_name%.*}"
      for data_file in "$base_dir/auditlogs"/${zip_file_name%.*}/*.txt; do
        data_file_name="$(basename "$data_file")"
        mv "$data_file" "$base_dir/auditlogs/${data_file_name%.*}_${zip_file_name%.*}.txt"
        rm -r "$base_dir/auditlogs/${zip_file_name%.*}"
      done
      rm "$zip_file"
    done
    shopt -u nullglob
    
    echo $(date +"%Y-%m-%d %H:%M:%S.%3N") "Downloaded UiPath Platform Audit logs and saved them according to UTC date"appId=$1
    appSecret=$2
    organizatioNameOrId=$3
    fromDate=$4
    toDate=$5
    mode=${6:-s}
    cloud=${7:-cloud}
    
    if [[ $# -lt 5 ]]; then
      echo "Error: Not all required input parameters provided."
      echo "Usage: $0 <appId> <appSecret> <organizatioNameOrId> <fromDate> <toDate> <mode>(optional: v for verbose, s for silent)"
      exit 1
    fi
    
    # Validate "fromDate" date format (MM/DD/YYYY)
    if ! date -d "$fromDate" &>/dev/null; then
      echo "Error: Invalid date format for 'fromDate'. Please use MM/DD/YYYY format."
      exit 1 
    fi
    
    # Validate "to" date format (MM/DD/YYYY)
    if ! date -d "$toDate" &>/dev/null; then
      echo "Error: Invalid date format for 'toDate'. Please use MM/DD/YYYY format."
      exit 1
    fi
    
    echo $(date +"%Y-%m-%d %H:%M:%S.%3N") "Start Getting UiPath Token."
    response=$(curl --data-urlencode -X POST "https://${cloud}.uipath.com/${organizationNameOrId}/identity_/connect/token" -$mode \
                -d "grant_type=client_credentials" \
                -d "scope=PM.Audit.Read" \
                -d "client_id=$appId" \
                -d "client_secret=$appSecret" \
                -H "Content-Type: application/x-www-form-urlencoded")
    
    access_token=$(echo "$response" | jq -r '.access_token')
    
    if [[ "$access_token" == null ]]; then
      echo "Error: Access token is null or empty in the response. Please verify the appId and appSecret."
      exit 1
    fi
    
    base_dir=$(date +"%Y-%m-%d%H:%M:%S.%3N")
    echo $base_dir "Start Downloading UiPath Platform Audit logs."
    # Define the base URL
    base_url="https://${cloud}.uipath.com/${organizatioNameOrId}/orgaudit_/api/query/downloadeventsfromlongtermstore"
    
    mkdir -p $base_dir
    # Iterate through time intervals
    current_date=$(date -u -d "$fromDate" +"%Y-%m-%dT%H:%M:%SZ")
    seconds_in_a_day=$((24*60*60))
    while [ "$(date -d "$current_date" +%s)" -le "$(date -d "$toDate" +%s)" ]; do
      next_date=$(date -u -d "$current_date + $(($seconds_in_a_day-1)) seconds" +"%Y-%m-%dT%H:%M:%SZ")
      
      # Construct the full URL with the current time interval
      formatted_current_date=$(date -u -d "$current_date" +"%Y-%m-%dT%H:%M:%SZ" | sed 's/\//%2F/g')
      formatted_current_date="${current_date}"
      formatted_next_date=$next_date | sed 's/\//%2F/g'
      formatted_next_date="${next_date}"
      full_url="$base_url?from=$formatted_current_date&to=$formatted_next_date"
    
      echo $full_url
    
      echo "Downloading UiPath Audit Log from $current_date to $next_date"
      curl -X GET "$full_url" -$mode \
           -H "Authorization: Bearer $access_token" \
           -o "${base_dir}/${current_date////-}_to_${next_date////-}.zip"  # Save the response to a file
      
      # Move to the next time interval
      current_date=$next_date
      one=1
      current_date=$(date -u -d "$current_date + $one seconds" +"%Y-%m-%dT%H:%M:%SZ")
    done
    
    for zip_file in "$base_dir"/*.zip; do
      zip_file_name="$(basename "$zip_file")"
      unzip -q "$zip_file" -d "$base_dir/auditlogs/"
      echo "Extracted ${zip_file_name%.*}"
      rm "$zip_file"
    done
    
    shopt -s nullglob
    for zip_file in "$base_dir/auditlogs"/*.zip; do
      zip_file_name="$(basename "$zip_file")"
      unzip -q "$zip_file" -d "$base_dir/auditlogs/${zip_file_name%.*}"
      for data_file in "$base_dir/auditlogs"/${zip_file_name%.*}/*.txt; do
        data_file_name="$(basename "$data_file")"
        mv "$data_file" "$base_dir/auditlogs/${data_file_name%.*}_${zip_file_name%.*}.txt"
        rm -r "$base_dir/auditlogs/${zip_file_name%.*}"
      done
      rm "$zip_file"
    done
    shopt -u nullglob
    
    echo $(date +"%Y-%m-%d %H:%M:%S.%3N") "Downloaded UiPath Platform Audit logs and saved them according to UTC date"
  2. 在 WSL(适用于 Linux 的 Windows 子系统)环境中运行脚本并确保已安装以下工具:
    sudo apt install dos2unix unzip jqsudo apt install dos2unix unzip jq
  3. 使用以下命令准备要执行的脚本:
    dos2unix <script-name>.sh
    chmod +x <script-name>.shdos2unix <script-name>.sh
    chmod +x <script-name>.sh
  4. 在租户中创建机密外部应用程序并分配以下 API 作用域: PM.Audit.Read (应用程序)。
  5. 收集以下应用程序凭据:

    • 应用程序 ID ( client_id )
    • 应用程序密码 ( client_secret )

步骤

  1. 在终端中设置所需的变量:
    client_id='<your-client-id>'
    client_secret='<your-client-secret>'
    org_name='<your-org-name>'
    start_date='MM/DD/YYYY'
    end_date='MM/DD/YYYY'client_id='<your-client-id>'
    client_secret='<your-client-secret>'
    org_name='<your-org-name>'
    start_date='MM/DD/YYYY'
    end_date='MM/DD/YYYY'
  2. 使用以下命令运行脚本: ./<script-name>.sh $client_id $client_secret $org_name $start_date $end_date

    例如:

    client_id='<clientId>'
    client_secret='<clientsecret>'
    org_name='test_org'
    start_date='09/01/2025'
    end_date='10/01/2025'
    ./<script-name>.sh $client_id $client_secret $org_name $start_date $end_date vclient_id='<clientId>'
    client_secret='<clientsecret>'
    org_name='test_org'
    start_date='09/01/2025'
    end_date='10/01/2025'
    ./<script-name>.sh $client_id $client_secret $org_name $start_date $end_date v

配置机器人日志导出

要将在 Orchestrator 服务中生成的 Robot 日志导出到 Azure、AWS S3 和 Google Cloud Storage,请遵循进一步描述的特定程序。 日志保存在uipathrobotlogs容器中的.csv文件中。 导出是按租户进行的,这有助于实现以下目的:
  • 存储必须保留的日志,以用于合规性和审计目的。
  • 在您自己的报告或 BI 工具中分析和可视化日志输出。

    注意:配置日志导出页面时,我们不支持回填 30 天的日志。
  1. 登录到您的 Automation Cloud™ 帐户。
  2. 导航到“管理员”,然后在左侧面板中选择租户。
  3. 选择“服务”。
  4. 在 Orchestrator 卡上,选择“更多”图标,然后选择“日志导出配置”

    “配置”面板将在窗口右侧打开。

  5. 启用“将 Robot 日志发送到自定义存储”开关。
  6. 从“存储类型”下拉列表中,选择要将日志导出到的存储提供程序。可选择以下选项:
    • Azure
    • AWS S3
    • Google Cloud Storage
    备注:

    日志导出功能不支持AWS KMS

  7. 执行特定于提供程序的步骤后,系统将生成 .csv
  8. 日志将按小时发送。此时间间隔不可配置。

Azure

提示:您可以将静态 IP 配置到允许列表,而不对所有外部 IP 开放网络。转到 Azure Blob 存储中的“设置” > “网络” > “公共访问” > “防火墙” > “地址范围” ,以添加静态 IP。请查看配置防火墙页面以获取 IP 的完整列表。


支持以下存储选项:
  • 标准本地冗余存储 (LRS)
  • 标准异地冗余存储 (GRS)
  • 标准读取访问异地冗余存储 (RA-GRS)
  • 标准区域冗余存储 (ZRS)
  • 高级 LRS
有关存储类型的更多信息,请查看 Azure 官方文档中的“存储帐户概述”页面。
  1. 从“存储类型”下拉列表中,选择“Azure 存储帐户”


  2. 在“Azure Blob 连接字符串”字段中,输入从 Azure 门户检索到的 Blob 连接字符串。


  3. 在“容器名称”字段中,输入 Azure 中用于存储 csv 的容器的名称。默认情况下为 uipathrobotlogs。如果提供了自定义容器名称,但该名称尚不存在,则系统将为您创建容器。
  4. 选择“保存”。 系统会显示一条通知,通知您已成功配置机器人日志导出。
  5. 在 Azure Portal 的 Blob 存储帐户中:
    • 在左侧面板中的“设置”下选择“网络”
    • 选择“允许的访问起点 > 所有网络”
    • 选择“保存”以保存更改。



  6. 在一个小时内,Blob 存储中将生成 .csv 日志文件。此 .csvuipathrobotlogs 容器中生成,位于以下文件夹层次结构 [tenant_key]/[year]/[month]/[day]/[hour]/output。建议一个租户对应一个容器,这是因为如果有多个租户路由到一个容器,则租户密钥是区分租户的唯一方法。


AWS S3

提示:您可以将静态 IP 配置到允许列表,而不对所有外部 IP 开放网络。使用 AWS S3 中的访问策略添加“拒绝”所有请求,除非来自aws:SourceIp列表的请求,如 AWS S3 用户指南中的Amazon S3 的存储桶策略页面中所述。查看 Automation Cloud 管理员指南中的“配置防火墙”页面,获取完整的 IP 列表。


  1. 从“存储类型”下拉列表中,选择“AWS S3”


  2. 在“存储桶名称”字段中,输入在 AWS 中配置的存储桶名称。
    注意:多个组织不能共享相同的存储桶名称。
  3. 在“区域名称”字段中,输入要导出日志的区域的名称。例如,us-west-1
  4. 确保向通过提示 s3:PutObjects3:DeleteObject提供的 IAM 用户授予存储桶访问权限。

Google Cloud Storage

  1. 从“存储类型”下拉列表中,选择“Google Cloud Storage”


  2. 在“存储桶名称”字段中,输入在 Google Cloud Platform 中配置的存储桶名称。
    注意:多个组织不能共享相同的存储桶名称。
  3. 根据以下提示中的指定,授予对 UiPath™ 服务帐户的适当访问权限:
    1. 在 Google Cloud Platform 中,导航到“存储” > “浏览器”
    2. 找到您要编辑权限的存储桶。
    3. 选择垂直省略号,然后选择“编辑存储桶权限”
    4. 选择“添加成员” ,然后输入用于访问存储桶的服务帐户。
    5. 选择角色下拉列表中,选择Storage Object Admin 。 如需了解详情,请参阅 GCP 文档中的身份和访问权限管理


删除日志导出设置

  1. 展开要为其删除日志导出设置的租户。
  2. 对于该租户中的 Orchestrator 服务,选择“日志导出配置” 。 系统将显示“配置”右侧面板。
  3. 禁用“将 Robot 日志发送到自定义存储”开关。
  4. “删除配置”窗口上,选择“删除”以确认。 已成功删除配置。
  • 使用脚本导出日志
  • 先决条件
  • 步骤
  • 配置机器人日志导出
  • Azure
  • AWS S3
  • Google Cloud Storage
  • 删除日志导出设置

此页面有帮助吗?

获取您需要的帮助
了解 RPA - 自动化课程
UiPath Community 论坛
Uipath Logo
信任与安全
© 2005-2026 UiPath。保留所有权利。