从 CVAD 核心组件上传 AOT 日志

如果您已在 HTTPS 模式下配置日志服务器 https://<LogServerFQDN>:port,请确保必要的证书已正确安装并在您的系统上受信任。

  1. 从 Storefront™ 上传 常驻跟踪 日志

    #Enable uploading in HTTP
    
    Set-STFDiagnosticsLogServer -Server LogServerFQDN:8080
    
    #Or to use HTTPS
    
    Set-STFDiagnosticsLogServer -Server https://LogServerFQDN:8443
    
    #Disable
    
    Clear-STFDiagnosticsLogServer
    
    #The configuration will take effect in one hour. To apply the changes immediately, restart the Citrix Telemetry Service.
    <!--NeedCopy-->
    
  2. 从 DDC 上传 AOT 日志:

    #Enable uploadng in HTTP
    Set-ConfigSite -LogServerEnabled $true -LogServerName LogServerFQDN -LogServerPort 8080
    
    #Or enable HTTPS
    Set-ConfigSite -LogServerEnabled $true -LogServerName https://LogServerFQDN -LogServerPort 8443
    #Disable HTTP
    Set-ConfigSite -LogServerEnabled $false -LogServerName LogServerFQDN -LogServerPort 8080
    #Disable HTTPS
    Set-ConfigSite -LogServerEnabled $false -LogServerName https://LogServerFQDN -LogServerPort 8443
    <!--NeedCopy-->
    
  3. 在 Windows 虚拟交付代理 上启用 常驻跟踪:

在安装 DDC 的计算机上,运行以下命令,之后您需要重新启动 Citrix Desktop Service 以使其立即生效。

```bash
#Initiate, run following commands in DDC powershell
$configSlot = New-BrokerConfigurationSlot -Name VdaAotTracing -Description VdaAotTracing -SettingsGroup G=Telemetry


#If using HTTPS, parameter of -Endpoint should be "https://logserverFQDN:8443"
$policy = New-BrokerLogServerAddress -Enabled $true -Endpoint "logserverFQDN:8080"
$mc = New-BrokerMachineConfiguration -ConfigurationSlotUid $configSlot.Uid -LeafName VdaAotTracing -Policy $policy


# Using the real DeliverygroupName of your VDA.
$dg = Get-BrokerDesktopGroup -Name "DeliverygroupName"
Add-BrokerMachineConfiguration -InputObject $mc -DesktopGroup $dg


#Restart Citrix Desktop Service in your VDA to make it take effect immediately.
<!--NeedCopy--> ```

日志服务器地址或端口更改时更新:

```bash
#Update, run following commands in DDC powershell
#If using HTTPS, parameter of -Endpoint should be "https://NewLogServerFQDN:8443"


$policy = New-BrokerLogServerAddress -Enabled $true -Endpoint "NewLogServerFQDN:8443"
Set-BrokerMachineConfiguration -Name "VdaAotTracing\VdaAotTracing" -Policy $policy
$mc=Get-BrokerMachineConfiguration -Name "VdaAotTracing\VdaAotTracing"

# Using the real DeliverygroupName of your VDA.
$dg = Get-BrokerDesktopGroup -Name "DeliverygroupName"
Add-BrokerMachineConfiguration -InputObject $mc -DesktopGroup $dg
#Restart Citrix Desktop Service in your VDA to make it take effect immediately.
<!--NeedCopy--> ```

如何禁用:

```bash
#Disable, run following commands in DDC powershell


#If using HTTPS, parameter of -Endpoint should be "https://LogServerFQDn:8443"
$policy = New-BrokerLogServerAddress -Enabled $false -Endpoint "LogServerFQDN:8080"
Set-BrokerMachineConfiguration -Name "VdaAotTracing\VdaAotTracing" -Policy $policy
$mc=Get-BrokerMachineConfiguration -Name "VdaAotTracing\VdaAotTracing"

# Using the real DeliverygroupName of your VDA.
$dg = Get-BrokerDesktopGroup -Name "DeliverygroupName"
Add-BrokerMachineConfiguration -InputObject $mc -DesktopGroup $dg

#Restart Citrix Desktop Service in your VDA to make it take effect immediately.

<!--NeedCopy--> ```
  1. 请直接在 WindowsVDA 上启用 AOT 功能:

直接在您要上传 AOT 的计算机 (WindowsVDA) 上运行该命令。这仅在应用该命令的计算机上生效。

```bash
# Enable AOT uploading for Windows VDA
#If using HTTPS, parameter of -AotDataStoreEndpoint should be "https://LogServerFQDN:8443"

Enable-CitrixAOTUpload -AotDataStoreEndpoint LogServerFQDN:8443 -Role WVDA

# Disable AOT uploading
Disable-CitrixAOTUpload
<!--NeedCopy--> ```

查看和使用 AOT 日志

通过日志服务器访问日志

为了确保日志安全,您需要在下载日志之前获取 AuthKey。操作步骤如下:

  1. 获取您的 AuthKey – 使用您自己的角色名称/名称来生成它。
  2. 本地运行 – 脚本只能在安装了 Docker 容器的计算机上运行。
  3. Windows 操作系统用户 – 请使用 GetAuthKey.bat 批处理脚本,而不是 shell 脚本。
  4. 下载日志 – 身份验证成功后,您可以安全地检索日志。

    For Linux
    ./GetAuthKey.sh role-name
    {"key":"ebac9b7726cb4be597c92c6769134d25","role":"role-name","status":"DONE"}
    
    For Windows
    GetAuthKey.bat role-name
    {"key":"ebac9b7726cb4be597c92c6769134d25","role":"role-name","status":"DONE"}
    
    #Save the key: ebac9b7726cb4be597c92c6769134d25 by yourself. It's the only way to get the key.
    <!--NeedCopy-->
    

列出已将其 AOT 日志发送到日志服务器的计算机名称:

```bash
#The parameter is the key get from GetAuthKey.sh
For linux:
./ListMachines.sh ebac9b7726cb4be597c92c6769134d25
{"machines":["MachineName"]}
#Empty machines means that there has no log

For Windows:
ListMachines.bat ebac9b7726cb4be597c92c6769134d25
{"machines":["MachineName"]}
#Empty machines means that there has no log
<!--NeedCopy--> ```

按计算机名称和时间范围下载日志。时间为 UTC 格式。

```bash
#Usage: ./DownloadLogsByTime.sh [AuthKey] [MachineName] [StartTime] [EndTime] [OutputFile]
#Example:

For Linux
./DownloadLogsByTime.sh ebac9b7726cb4be597c92c6769134d25 MachineName 2025-01-01T00:00:00Z 2025-01-02T00:00:00Z logs.csv

For Windows
DownloadLogsByTime.bat ebac9b7726cb4be597c92c6769134d25 MachineName 2025-01-01T00:00:00Z 2025-01-02T00:00:00Z logs.csv
<!--NeedCopy--> ```

按关键字/过滤器下载日志。时间为 UTC 格式:

注意:

  • 关键字可以是单个词或词的组合。
  • 关键字可以匹配日志消息中的任何位置。
  • 事务 ID 也可以用作关键字。
```bash
#Usage: ./DownloadLogsByWords.sh [AuthKey] [StartTime] [EndTime] [SearchWords] [OutputFile]

#Example:
For Linux:
./DownloadLogsByWords.sh authkey 2025-01-01T00:00:00.000Z 2025-12-31T23:59:59.999Z "session launch" logs.csv

For Windows:
DownloadLogsByWords.bat authkey 2025-01-01T00:00:00.000Z 2025-12-31T23:59:59.999Z "failed vda" logs.csv
<!--NeedCopy--> ```
从 CVAD 核心组件上传 AOT 日志