Azure Stack Hub 中的诊断日志收集Diagnostic log collection in Azure Stack Hub

Azure Stack Hub 是一个大型集合,包含可以彼此交互的 Windows 组件和本地 Azure 服务。Azure Stack Hub is a large collection of both Windows components and on-premise Azure services interacting with each other. 所有这些组件和服务都会生成自己的日志集。All these components and services generate their own set of logs. 为了让 Azure 支持能够有效地诊断问题,我们提供了用于收集诊断日志的无缝体验。To enable Azure Support to diagnose issues efficiently, we've provided a seamless experience for diagnostic log collection.

使用“帮助 + 支持”中的诊断日志收集功能,操作员可以在简单的用户界面中快速收集诊断日志并与 Azure 支持共享该日志,而无需使用 PowerShell。Diagnostic log collection in Help + support helps operators quickly collect and share diagnostic logs with Azure Support in an easy user interface, which doesn't require PowerShell. 即使其他基础结构服务关闭,也可以收集日志。Logs get collected even if other infrastructure services are down.

使用“帮助和支持”中的诊断日志收集功能,操作员可以快速地通过 Microsoft 客户支持服务 (CSS) 收集和共享诊断日志,该服务是一个易用的用户界面,不需要 PowerShell。Diagnostic log collection in Help and Support helps operators quickly collect and share diagnostic logs with Microsoft Customer Support Services (CSS), an easy user interface, which does not require PowerShell. 即使其他基础结构服务关闭,也可以收集日志。Logs get collected even if other infrastructure services are down.

建议使用此日志收集方法,并且仅当管理员门户或“帮助和支持”边栏选项卡不可用时才使用特权终结点 (PEP)It is recommended to use this approach of log collection and only resort to using the privileged endpoint (PEP) if the Administrator portal or Help and Support blade is unavailable.

备注

必须注册 Azure Stack Hub 才能使用诊断日志收集。Azure Stack Hub must be registered to use diagnostic log collection. 如果未注册 Azure Stack Hub,请使用 Get-AzureStackLog 来共享日志。If Azure Stack Hub is not registered, use Get-AzureStackLog to share logs.

Azure Stack Hub 中的诊断日志收集选项

收集选项和数据处理Collection options and data handling

根据与 Azure 的连接情况,Azure Stack Hub 提供了将诊断日志收集、保存和发送到 CSS 的适当方式。Depending on connectivity to Azure, Azure Stack Hub has suitable ways to collect, save, and send diagnostic logs to CSS. 如果 Azure Stack Hub 可以连接到 Azure,推荐的方法是启用“主动日志收集”,这会在引发关键警报时自动将诊断日志上传到 Azure 中由 Microsoft 控制的存储 blob。If Azure Stack Hub can connect to Azure, the recommended way is to enable Proactive log collection, which will automatically upload diagnostic logs to a Microsoft-controlled storage blob in Azure when a critical alert gets raised. 还可以通过使用“立即发送日志”来按需收集日志,或者,如果 Azure Stack Hub 与 Azure 断开连接,可以在本地保存日志。You can alternatively collect logs on-demand by using Send logs now, or you can save logs locally if Azure Stack Hub is disconnected from Azure.

以下部分说明了每个选项以及如何在各种情况下处理数据。The following sections explain each option and how your data is handled in each case.

诊断日志收集功能提供两个用于发送日志的选项。Diagnostic log collection feature offers two options to send logs. 以下部分说明了每个选项以及如何在各种情况下处理数据。The following sections explain each option and how your data is handled in each case.

主动发送日志Send logs proactively

主动收集日志可优化和简化诊断日志收集过程,让客户可以在建立支持案例之前将日志发送给 Azure。Proactive log collection streamlines and simplifies diagnostic log collection so customers can send logs to Azure before opening a support case. 可以从 Azure Stack Hub 主动上传要分析的诊断日志。Diagnostic logs are proactively uploaded from Azure Stack Hub for analysis. 这些日志仅在发出了系统运行状况警报的情况下收集,并且仅在建立了支持案例的情况下供 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.

数据处理方式How the data is handled

你同意 Azure 可以仅根据 Azure Stack Hub 系统运行状况警报定期自动收集日志。You agree to periodic automatic log collections by Azure 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 天,由 Azure 收集的任何数据都会按照我们的标准隐私做法进行处理。The data can be retained for up to 90 days and any data Azure collects 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 的运行状况,Azure 可能会访问这些日志。These logs may be accessed by Azure in the context of a support case and to improve the health of Azure Stack Hub.

立即发送日志Send logs now

立即发送日志是一个手动选项。如果选择该选项,那么仅当你以客户身份启动收集操作时(通常在提交支持案例之前),才会将诊断日志从 Azure Stack Hub 上传。Send logs now is a manual option where diagnostic logs are uploaded from Azure Stack Hub only when you (as the customer) initiate the collection, usually before opening a support case.

Azure Stack 操作员可以使用管理员门户或 PowerShell 将诊断日志按需发送到 Azure 支持。Azure Stack operators can send diagnostics logs on-demand to Azure Support by using the administrator portal or PowerShell. 如果 Azure Stack Hub 已连接到 Azure,建议使用管理员门户中的“立即发送日志”选项,因为这是直接将日志发送到 Azure 的最简单方法。If Azure Stack Hub is connected to the Azure, using Send logs now in the administrator portal is recommended because it's the simplest way to send the logs directly to Azure. 如果门户不可用,则操作员应改为使用 PowerShell 立即发送日志If the portal is unavailable, operators should instead send logs now using PowerShell.

如果已断开与 Internet 的连接,或者只想在本地保存日志,请使用 Get-AzureStackLog 方法发送日志。If you are disconnected from the internet or want to only save logs locally, use Get-AzureStackLog method to send logs. 以下流程图显示了各种情况下用于发送诊断日志的选项。The following flowchart shows which option to use for sending diagnostic logs in each case.

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

数据处理方式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 SMB share when Azure Stack Hub is disconnected from Azure. 在“设置”边栏选项卡中,输入具有共享写入权限的路径、用户名和密码。In the Settings blade, enter the path and a username and password with permission to write to the share. 在“支持用例”期间,Microsoft CSS 将提供有关如何传输这些本地日志的详细步骤。During a support case, Microsoft CSS will provide detailed steps on how to get these local logs transferred.

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

带宽注意事项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 an additional charge from your ISP for the extra network usage.

从多个 Azure Stack Hub 系统收集日志Collecting logs from multiple Azure Stack Hub systems

为每个需要从其收集日志的 Azure Stack Hub 缩放单元设置一个 Blob 容器。Set up one blob container for every Azure Stack Hub scale unit you want to collect logs from. 若要详细了解如何配置 Blob 容器,请参阅配置 Azure Stack Hub 诊断日志自动收集For more information about how to configure the blob container, see Configure automatic Azure Stack Hub diagnostic log collection. 最佳做法是仅将同一 Azure Stack Hub 缩放单元中的诊断日志保存到单个 Blob 容器中。As a best practice, only save diagnostic logs from the same Azure Stack Hub scale unit within a single blob container.

保留策略Retention policy

创建 Azure Blob 存储生命周期管理规则,管理日志保留策略。Create an Azure Blob storage lifecycle management rule to manage the log retention policy. 建议将诊断日志保留 30 天。We suggest retaining diagnostic logs for 30 days. 若要在 Azure 存储中创建生命周期管理规则,请登录到 Azure 门户,选择“存储帐户”再选择 Blob 容器,然后在“Blob 服务”下选择“生命周期管理” 。To create a lifecycle management rule in Azure storage, sign in to the Azure portal, select Storage accounts, select the blob container, and under Blob service, select Lifecycle Management.

Azure 门户中的生命周期管理

SAS 令牌过期SAS token expiration

将 SAS URL 到期时间设置为两年。Set the SAS URL expiry to two years. 如果续订存储帐户密钥,请确保重新生成 SAS URL。If you ever renew your storage account keys, make sure to regenerate the SAS URL. 应按最佳做法管理 SAS 令牌。You should manage the SAS token according to best practices. 有关详细信息,请参阅使用 SAS 时的最佳做法For more information, see Best practices when using SAS.

带宽消耗Bandwidth consumption

进行诊断日志收集时日志的平均大小各不相同,具体取决于日志收集是按需的还是自动的。The average size of diagnostic log collection varies based on whether log collection is on-demand or automatic.

对于按需日志收集,进行日志收集时日志的大小取决于需要收集多少小时。For on-demand log collection, the size of the logs collection depends on how many hours are being collected. 可以从过去七天选择 1-4 小时滑动窗口。You can choose any 1-4 hour sliding window from the last seven days.

启用诊断日志自动收集时,服务会对是否存在严重警报进行监视。When automatic diagnostic log collection is enabled, the service monitors for critical alerts. 在严重警报出现并持续大约 30 分钟后,服务会收集并上传相应的日志。After a critical alert gets raised and persists for around 30 minutes, the service collects and uploads appropriate logs. 该日志收集的日志大小平均约为 2 GB。This log collection size is around 2 GB on average. 如果修补升级失败,则仅当严重警报出现并持续约 30 分钟时,才会启动日志自动收集。If there's a patch and update failure, automatic log collection will start only if a critical alert is raised and persists for around 30 minutes. 建议按照监视修补升级指南操作。We recommend you follow guidance on monitoring the patch and update. 警报监视、日志收集和上传对用户透明。Alert monitoring, log collection, and upload are transparent to the user.

在正常运行的系统中,根本不会收集到日志。In a healthy system, logs won't be collected at all. 在运行不正常的系统中,可能会每天运行两到三次日志收集,但通常只运行一次。In an unhealthy system, log collection may run two or three times in a day, but typically only once. 在最糟糕的情况下,每天可能运行多达 10 次。At most, it could potentially run up to 10 times in a day in a worst-case scenario.

用户可以根据下表考虑在以受限或计量方式连接到 Azure 时启用日志自动收集对环境的影响。The following table can help environments with limited or metered connections to Azure consider the impact of enabling automatic log collection.

网络连接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 an additional charge from your ISP for the extra network usage.

管理成本Managing costs

Azure Blob 存储费用取决于每月保存的数据量以及其他因素,例如数据冗余。Azure blob storage charges depend on how much data is saved each month and other factors like data redundancy. 如果没有现有的存储帐户,可以登录到 Azure 门户,选择“存储帐户”,然后按步骤创建 Azure Blob 容器 SAS URLIf you don't have an existing storage account, you can sign in to the Azure portal, select Storage accounts, and follow the steps to create an Azure blob container SAS URL.

最佳做法是创建 Azure Blob 存储生命周期管理策略,尽量降低持续产生的存储成本。As a best practice, create an Azure Blob storage lifecycle management policy to minimize ongoing storage costs. 若要详细了解如何设置存储帐户,请参阅配置 Azure Stack Hub 诊断日志自动收集For more information about how to set up the storage account, see Configure automatic Azure Stack Hub diagnostic log collection

另请参阅See also

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