诊断日志收集Diagnostic log collection

你可以共享由 Azure Stack Hub 创建的诊断日志。You can share diagnostic logs created by Azure Stack Hub. 这些日志由 Windows 组件和本地 Azure 服务创建。These logs are created by the Windows components and on-premises Azure services. Azure 支持部门可以使用日志来修复或识别 Azure Stack Hub 实例的问题。Azure Support can use the logs to fix or identify issues with your Azure Stack Hub instance.

若要开始使用 Azure Stack Hub 诊断日志收集,必须注册实例。To get started with Azure Stack Hub diagnostic log collection, you have to register your instance. 如果尚未注册 Azure Stack Hub,请使用特权终结点 (PEP) 来共享日志。If you haven't registered Azure Stack Hub, use the privileged endpoint (PEP) to share logs.

可以通过多种方式将诊断日志发送到 Azure 支持。You have multiple ways to send diagnostic logs to Azure Support. 根据与 Azure 的连接,选项包括:Depending on your connectivity to Azure, your options include:

以下流程图显示了用于发送诊断日志的选项。The flowchart shows which option to use for sending diagnostic logs. 如果 Azure Stack Hub 连接到 Azure,请启用“主动日志收集”。If Azure Stack Hub connects to Azure, enable Proactive log collection. 主动日志收集在引发关键警报时自动将诊断日志上传到 Azure 中由 Azure 控制的存储 blob。Proactive log collection automatically uploads diagnostic logs to a Azure-controlled storage blob in Azure when a critical alert gets raised. 还可使用“立即发送日志”按需收集日志。You can also collect logs on-demand by using Send logs now. 对于在断开连接的环境中运行的 Azure Stack Hub,或者如果遇到连接问题,请选择“在本地保存日志”。For an Azure Stack Hub that runs in a disconnected environment, or if you're having connectivity issues, choose to Save logs locally.

流程图,显示如何将日志立即发送到 Microsoft

主动发送日志Send logs proactively

在你建立支持案例之前,主动收集日志功能会自动从 Azure Stack Hub 收集诊断日志并将其发送给我们。Proactive log collection automatically collects and sends diagnostic logs from Azure Stack Hub to us before you open a support case. 这些日志仅在发出了系统运行状况警报的情况下收集,并且仅在建立了支持案例的情况下供 Azure 支持访问。These logs are only collected when a system health alert is raised and are only accessed by Azure Support in the context of a support case.

从 Azure Stack Hub 版本 2008 开始,主动收集日志的功能使用改进的算法,即使在操作员看不到的错误情况下也可以捕获日志。Beginning with Azure Stack Hub version 2008, proactive log collection uses an improved algorithm that captures logs even during error conditions that aren't visible to an operator. 这样可以确保在适当的时间收集正确的诊断信息,无需操作员进行任何交互。This makes sure that the right diagnostic info is collected at the right time without needing any operator interaction. 在某些情况下,Azure 支持可以更快地开始故障排除工作并解决问题。Azure support can begin troubleshooting and resolve problems sooner in some cases. 初始算法改进侧重于修补升级操作。Initial algorithm improvements focus on patch and update operations.

Azure Stack Hub 将收集警报和其他隐藏的故障事件的日志,这些日志对于你来说是不可见的。Azure Stack Hub collects logs for alerts and other hidden failure events, which aren't visible to you.

Azure Stack Hub 将主动收集以下方面的日志:Azure Stack Hub proactively collects logs for:

  • 更新失败。Update failed.
  • 更新需要注意。Update needs attention.

当事件触发这些警报时,Azure Stack Hub 会主动将日志发送到 Azure。When an event triggers these alerts, Azure Stack Hub proactively sends the logs to Azure.

此外,Azure Stack Hub 将由其他故障事件触发的日志发送到 Azure。In addition, Azure Stack Hub sends logs to Azure triggered by other failure events. 这些事件对你不可见。These events are not visible to you.

建议启用主动收集日志的功能,因为更多的操作已经过优化,好处更多。Enabling proactive log collections is recommended as more operations are optimized and the benefits increase.

随时可以禁用和重新启用主动日志收集。Proactive log collection can be disabled and re-enabled anytime. 按照以下步骤设置主动收集日志功能。Follow these steps to set up proactive log collection.

  1. 登录到 Azure Stack Hub 管理员门户。Sign in to the Azure Stack Hub administrator portal.
  2. 打开“帮助 + 支持概述”。Open Help + support Overview.
  3. 如果出现横幅,请选择“启用主动收集日志功能”。If the banner appears, select Enable proactive log collection. 也可以选择“设置”,将“主动收集日志”设置为“启用”,然后选择“保存” 。Or you can select Settings and set Proactive log collection to Enable, then select Save.

备注

如果为本地文件共享配置了日志位置设置,请确保生命周期管理策略会阻止共享存储达到其容量配额。If log location settings are configured for a local file share, make sure lifecycle management policies will prevent share storage from reaching its size quota. Azure Stack Hub 不会监视本地文件共享或强制执行任何保留策略。Azure Stack Hub does not monitor local file share or enforce any retention policies.

数据处理方式How the data is handled

你同意我们可以仅根据 Azure Stack Hub 系统运行状况警报定期自动收集日志。You agree to periodic automatic log collections by us based only on Azure Stack Hub system health alerts. 你还确认并同意,这些日志可以上传并保留在由 Azure 管理和控制的 Azure 存储帐户中。You also acknowledge and consent to the upload and retention of those logs in an Azure storage account managed and controlled by Azure.

这些数据只用于排查系统运行状况警报问题,在未经你同意的情况下不会用于市场营销、广告或任何其他商业目的。The data will be used only troubleshooting system health alerts and won't be used for marketing, advertising, or any other commercial purposes without your consent. 这些数据最多可保留 90 天,由我们收集的任何数据都会按照我们的标准隐私做法进行处理。The data can be retained for up to 90 days and any data We collect will be handled following our standard privacy practices.

如果你不再同意,则以前在你同意的情况下收集的任何数据都不会受到影响。Any data previously collected with your consent won't be affected by the revocation of your permission.

通过“主动收集日志”方式收集的日志会上传到由 Azure 管理和控制的 Azure 存储帐户中。Logs collected using Proactive log collection are uploaded to an Azure storage account managed and controlled by Azure. 在收到支持案例的情况下,或者是为了改善 Azure Stack Hub 的运行状况,我们可能会访问这些日志。These logs may be accessed by us in the context of a support case and to improve the health of Azure Stack Hub.

立即发送日志Send logs now

提示

通过使用主动发送日志而不是“立即发送日志”来节省时间。Save time by using Send logs proactively instead of Send logs now.

“立即发送日志”是一个选项,通常用于在建立支持案例之前从 Azure Stack Hub 手动收集并上传诊断日志。Send logs now is an option where you manually collect and uploads your diagnostic logs from Azure Stack Hub, usually before opening a support case.

可以通过两种方式手动将诊断日志发送到 Azure 支持:There are two ways you can manually send diagnostic logs to Azure Support:

如果 Azure Stack Hub 已连接到 Azure,建议你使用管理员门户,因为这是直接将日志发送给我们的最简单方法。If Azure Stack Hub is connected to Azure, we recommend using the administrator portal because it's the simplest way to send the logs directly to us. 如果该门户不可用,应改为使用 PowerShell 发送日志。If the portal is unavailable, you should send logs using PowerShell.

通过管理员门户立即发送日志Send logs now with the administrator portal

通过管理员门户立即发送日志:To send logs now using the administrator portal:

  1. 打开“帮助 + 支持”>“日志收集”>“立即发送日志”。Open Help + support > Log Collection > Send logs now.
  2. 指定日志收集的开始时间和结束时间。Specify the start time and end time for log collection.
  3. 选择本地时区。Choose the local time zone.
  4. 选择“收集并上传”。Select Collect and Upload.

如果已断开与 Internet 的连接,或者只想在本地保存日志,请使用 Get-AzureStackLog 方法发送日志。If you're disconnected from the internet or want to only save logs locally, use the Get-AzureStackLog method to send logs.

通过 PowerShell 立即发送日志Send logs now with PowerShell

如果使用“立即发送日志”方法并想要使用 PowerShell 而不是管理员门户,则可使用 Send-AzureStackDiagnosticLog cmdlet 来收集和发送特定日志。If you're using the Send logs now method and want to use PowerShell instead of the administrator portal, you can use the Send-AzureStackDiagnosticLog cmdlet to collect and send specific logs.

  • 可以使用 FromDateToDate 参数来收集特定时间段的日志。The FromDate and ToDate parameters can be used to collect logs for a particular time period. 如果未指定这些参数,则默认收集过去四小时的日志。If these parameters aren't specified, logs are collected for the past four hours by default.

  • 使用 FilterByNode 参数按计算机名筛选日志。Use the FilterByNode parameter to filter logs by computer name. 例如:For example:

    Send-AzureStackDiagnosticLog -FilterByNode azs-xrp01
    
  • 使用 FilterByLogType 参数按类型筛选日志。Use the FilterByLogType parameter to filter logs by type. 可以选择按文件、共享或 WindowsEvent 进行筛选。You can choose to filter by File, Share, or WindowsEvent. 例如:For example:

    Send-AzureStackDiagnosticLog -FilterByLogType File
    
  • 使用 FilterByResourceProvider 参数为增值资源提供程序 (RP) 发送诊断日志。Use the FilterByResourceProvider parameter to send diagnostic logs for value-add Resource Providers (RPs). 常规语法为:The general syntax is:

    Send-AzureStackDiagnosticLog -FilterByResourceProvider <<value-add RP name>>
    

    为 SQL RP 发送诊断日志:To send diagnostic logs for SQL RP:

    Send-AzureStackDiagnosticLog -FilterByResourceProvider SQLAdapter
    

    为 MySQL RP 发送诊断日志:To send diagnostic logs for MySQL RP:

    Send-AzureStackDiagnosticLog -FilterByResourceProvider MySQLAdapter
    

    为 IoT 中心发送诊断日志:To send diagnostic logs for IoT Hub:

    Send-AzureStackDiagnosticLog -FilterByResourceProvider IotHub
    

    为事件中心发送诊断日志:To send diagnostic logs for Event Hubs:

    Send-AzureStackDiagnosticLog -FilterByResourceProvider eventhub
    
  • 使用 FilterByRole 参数从 VirtualMachines 和 BareMetal 角色发送诊断日志:Use the FilterByRole parameter to send diagnostic logs from VirtualMachines and BareMetal roles:

    Send-AzureStackDiagnosticLog -FilterByRole VirtualMachines,BareMetal
    
  • 从 VirtualMachines 和 BareMetal 角色发送诊断日志,通过日期筛选功能筛选出过去 8 小时的日志文件:To send diagnostic logs from VirtualMachines and BareMetal roles, with date filtering for log files for the past 8 hours:

    Send-AzureStackDiagnosticLog -FilterByRole VirtualMachines,BareMetal -FromDate (Get-Date).AddHours(-8)
    
  • 从 VirtualMachines 和 BareMetal 角色发送诊断日志,通过日期筛选功能筛选出 8 小时前到 2 小时前这个时间段的日志文件:To send diagnostic logs from VirtualMachines and BareMetal roles, with date filtering for log files for the time period between 8 hours ago and 2 hours ago:

    Send-AzureStackDiagnosticLog -FilterByRole VirtualMachines,BareMetal -FromDate (Get-Date).AddHours(-8) -ToDate (Get-Date).AddHours(-2)
    

备注

如果已断开与 Internet 的连接,或者只想在本地保存日志,请使用 Get-AzureStackLog 方法发送日志。If you're disconnected from the internet or want to only save logs locally, use Get-AzureStackLog method to send logs.

数据处理方式How the data is handled

启动从 Azure Stack Hub 收集诊断日志的操作即表明你确认并同意,这些日志可以上传并保留到 Azure 管理和控制的 Azure 存储帐户中。By initiating diagnostic log collection from Azure Stack Hub, you acknowledge and consent to uploading those logs and retaining them in an Azure storage account managed and controlled by Azure. Azure 支持人员可以通过支持案例立即访问这些日志,而不必与客户联系以收集日志。Azure Support can access these logs right away with the support case without having to engage with the customer for log collection.

在本地保存日志Save logs locally

当 Azure Stack Hub 与 Azure 断开连接时,可以将日志保存到本地服务器消息块 (SMB) 共享。You can save logs to a local Server Message Block (SMB) share when Azure Stack Hub is disconnected from Azure. 例如,你可以运行断开连接的环境。You may, for example, run a disconnected environment. 如果在正常连接的情况下遇到连接问题,则可以在本地保存日志以帮助进行故障排除。If you're normally connected but are experiencing connectivity issues, you can save logs locally to help with troubleshooting.

在“设置”边栏选项卡中,输入具有共享写入权限的路径、用户名和密码。In the Settings blade, enter the path and a username and password with permission to write to the share. 在支持案例期间,Azure 支持会提供详细步骤来说明如何传输这些本地日志。During a support case, Azure Support will provide detailed steps on how to get these local logs transferred. 如果管理员门户不可用,则可以使用 Get-AzureStackLog 在本地保存日志。If the Administrator portal is unavailable, you can use Get-AzureStackLog to save logs locally.

诊断日志收集选项的屏幕截图

带宽注意事项Bandwidth considerations

进行诊断日志收集时日志的平均大小各不相同,具体取决于它是主动运行还是手动运行。The average size of diagnostic log collection varies based on whether it runs proactively or manually. “主动收集日志”选项对应的日志平均大小约为 2 GB。The average size for Proactive log collection is around 2 GB. “立即发送日志”选项对应的收集大小取决于需要收集多少小时。The collection size for Send logs now depends on how many hours are being collected.

下表列出了在以受限或计量方式连接到 Azure 时的环境注意事项。The following table lists considerations for environments with limited or metered connections to Azure.

网络连接Network connection 影响Impact
低带宽/高延迟连接Low-bandwidth/high-latency connection 完成日志上传的时间会延长。Log upload will take an extended amount of time to complete.
共享连接Shared connection 上传也可能影响共享网络连接的其他应用/用户。The upload may also impact other apps/users sharing the network connection.
计量连接Metered connection ISP 可能会针对你额外使用网络的情况另行收费。There may be another charge from your ISP for the extra network usage.

查看日志集合View log collection

以往从 Azure Stack Hub 收集的日志显示在“帮助 + 支持”中的“日志收集”页上,其中提供了以下日期和时间 :The history of logs collected from Azure Stack Hub appears on the Log collection page in Help + support, with the following dates and times:

  • 收集的时间:日志收集操作的开始时间。Time Collected: When the log collection operation began.
  • 状态:“正在进行”或“已完成”。Status: Either in progress or complete.
  • 日志开始:要收集日志的时段的开始时间。Logs start: Start of the time period for which you want to collect.
  • 日志结束:收集时段的结束时间。Logs end: End of the time period.
  • 类型:是手动收集日志还是主动收集日志。Type: If it's a manual or proactive log collection.

“帮助 + 支持”中的日志集合

另请参阅See also

Azure Stack Hub 日志和客户数据处理Azure Stack Hub log and customer data handling