收集 Azure Application Gateway 日志
支持的平台:
Google SecOps
SIEM
本文档介绍了如何通过设置 Google 安全运营 Feed 来收集 Azure Application Gateway 日志。此解析器可处理单记录和多记录 JSON 结构,从“records”数组中提取字段,执行数据类型转换,将字段映射到 UDM,并使用元数据和派生字段(例如网络连接类型)丰富数据。它还会针对不同的 operationName
值处理特定逻辑,提取相关 IP 地址、子网和其他配置详细信息。
准备工作
确保您已完成以下两项操作:
- Google SecOps 实例。
- 对 Azure 订阅的特权访问权限。
- Azure 中的 Azure 应用网关环境(租户)。
配置 Azure 存储账号
- 在 Azure 控制台中,搜索存储账号。
- 点击创建。
- 为以下输入参数指定值:
- 订阅:选择相应订阅。
- 资源组:选择资源组。
- 地区:选择地区。
- 效果:选择效果(推荐“标准”)。
- 冗余:选择冗余级别(建议使用 GRS 或 LRS)。
- 存储账号名称:为新存储账号输入名称。
- 点击 Review + create(检查 + 创建)。
- 查看账号概览,然后点击创建。
- 在存储账号概览页面上,选择安全 + 网络中的子菜单 Access keys(访问密钥)。
- 点击 key1 或 key2 旁边的显示
- 点击复制到剪贴板以复制密钥。
- 将密钥保存在安全的位置,以备日后使用。
- 在存储空间账号概览页面中,选择设置中的子菜单 Endpoints。
- 点击复制到剪贴板以复制Blob 服务端点网址。(例如
https://<storageaccountname>.blob.core.windows.net
) - 将端点网址保存在安全的位置,以备日后使用。
配置 Azure Application Gateway
- 登录 Azure 门户。
- 前往所需的资源组。
- 选择应用网关(系统随即会显示 Application gateway 窗口)。
- 在 Monitoring 部分中,依次选择 Diagnostic settings > Turn on diagnostics。
- 选择添加诊断设置(诊断设置窗口会显示诊断日志的设置)。
- 在日志部分,执行以下操作:
- 选中 ApplicationGatewayAccessLog 复选框。
- 选中 ApplicationGatewayFirewallLog 复选框。
- 如需将日志存储在存储账号中,请执行以下操作:
- 选中归档到存储账号复选框。
- 在订阅列表中,选择一个现有订阅。
- 在存储账号列表中,选择一个现有存储账号。
在 Google SecOps 中配置 Feed 以提取 Azure Application Gateway 日志
- 依次前往 SIEM 设置 > Feed。
- 点击新增。
- 在Feed 名称字段中,输入 Feed 的名称(例如 Azure Application Gateway 日志)。
- 选择 Microsoft Azure Blob Storage 作为来源类型。
- 选择 Azure Application Gateway 作为日志类型。
- 点击下一步。
为以下输入参数指定值:
- Azure URI:Blob 端点网址。
ENDPOINT_URL/BLOB_NAME
- 替换以下内容:
ENDPOINT_URL
:blob 端点网址。(https://<storageaccountname>.blob.core.windows.net
)BLOB_NAME
:blob 的名称。(例如insights-logs-<logname>
)
- 替换以下内容:
- URI 是:根据日志流配置选择 URI 类型(单个文件 | 目录 | 包含子目录的目录)。
- 来源删除选项:根据您的偏好选择删除选项。
- 共享密钥:Azure Blob Storage 的访问密钥。
- 资源命名空间:资源命名空间。
- 提取标签:要应用于此 Feed 中的事件的标签。
- Azure URI:Blob 端点网址。
点击下一步。
在最终确定界面中查看新的 Feed 配置,然后点击提交。
UDM 映射表
日志字段 | UDM 映射 | 逻辑 |
---|---|---|
Category |
metadata.product_event_type |
直接从 Category 字段映射。 |
ClientOperationId |
additional.fields[].key:"ClientOperationId", value.string_value |
直接从 ClientOperationId 字段映射。 |
CorrelationRequestId |
additional.fields[].key:"CorrelationRequestId", value.string_value |
直接从 CorrelationRequestId 字段映射。 |
GatewayManagerVersion |
additional.fields[].key:"GatewayManagerVersion", value.string_value |
直接从 GatewayManagerVersion 字段映射。 |
category |
metadata.product_event_type |
直接从 category 字段映射。 |
level |
security_result.severity |
直接从 level 字段映射,并转换为大写形式。如果值为“WARNING”,则严重程度设为“HIGH”,并将 security_result.severity_details 设为原始值。 |
properties.clientIP |
principal.ip ,principal.asset.ip |
直接从 properties.clientIP 字段映射。 |
properties.clientPort |
principal.port |
直接从 properties.clientPort 字段映射,并转换为整数。 |
properties.clientResponseTime |
additional.fields[].key:"clientResponseTime", value.string_value |
直接从 properties.clientResponseTime 字段映射。 |
properties.configuration.BgpConfiguration.GatewayConfig.Asn |
security_result.detection_fields[].key:"ASN", value |
当 operationName 为“SetGatewayConfiguration”时,直接从 properties.configuration.BgpConfiguration.GatewayConfig.Asn 字段映射。 |
properties.configuration.BgpConfiguration.GatewayConfig.PeerAddress |
target.ip ,target.asset.ip |
当 operationName 为“SetGatewayConfiguration”时,直接从 properties.configuration.BgpConfiguration.GatewayConfig.PeerAddress 字段映射。 |
properties.configuration.BgpConfiguration.GatewayConfig.PeerType |
security_result.detection_fields[].key:"PeerType", value |
当 operationName 为“SetGatewayConfiguration”时,直接从 properties.configuration.BgpConfiguration.GatewayConfig.PeerType 字段映射。 |
properties.configuration.IkeVersion |
principal.resource.attribute.labels[].key:"ike_version", value |
当 operationName 为“SetConnectionConfiguration”时,直接从 properties.configuration.IkeVersion 字段映射。 |
properties.configuration.LocalSubnets |
principal.resource.attribute.labels[].key:"local subnets", value |
当 operationName 为“SetConnectionConfiguration”时,properties.configuration.LocalSubnets 数组中的 IP 地址串联字符串。 |
properties.configuration.LocalTunnelEndpoint |
principal.ip ,principal.asset.ip |
当 operationName 为“SetConnectionConfiguration”时,直接从 properties.configuration.LocalTunnelEndpoint 字段映射。 |
properties.configuration.Name |
principal.hostname ,principal.asset.hostname |
直接从 properties.configuration.Name 字段映射。如果为空,则值取自 properties.instance 。 |
properties.configuration.RemoteSite |
target.hostname ,target.asset.hostname |
直接从 properties.configuration.RemoteSite 字段映射。 |
properties.configuration.RemoteSubnets |
principal.resource.attribute.labels[].key:"remote subnets", value |
当 operationName 为“SetConnectionConfiguration”时,properties.configuration.RemoteSubnets 数组中的 IP 地址串联字符串。 |
properties.configuration.RemoteTunnelEndpoint |
target.ip ,target.asset.ip |
当 operationName 为“SetConnectionConfiguration”时,直接从 properties.configuration.RemoteTunnelEndpoint 字段映射。 |
properties.configuration.VIPAddress |
principal.ip ,principal.asset.ip |
当 operationName 为“SetGatewayConfiguration”时,直接从 properties.configuration.VIPAddress 字段映射。 |
properties.configuration.VirtualNetworkRanges |
principal.resource.attribute.labels[].key:"virutal network ranges", value |
当 operationName 为“SetGatewayConfiguration”时,properties.configuration.VirtualNetworkRanges 数组中的 IP 地址串联字符串。 |
properties.configuration.VirtualNetworkSubnets |
principal.resource.attribute.labels[].key:"virtual network subnets", value |
当 operationName 为“SetGatewayConfiguration”时,properties.configuration.VirtualNetworkSubnets 数组中的 IP 地址串联字符串。 |
properties.error_info |
additional.fields[].key:"error_info", value.string_value |
直接从 properties.error_info 字段映射。 |
properties.host |
principal.hostname ,principal.asset.hostname |
如果 properties.originalHost 为空,则直接从 properties.host 字段映射。 |
properties.httpMethod |
network.http.method |
直接从 properties.httpMethod 字段映射。 |
properties.httpStatus |
network.http.response_code |
直接从 properties.httpStatus 字段映射,并转换为整数。 |
properties.httpVersion |
network.application_protocol |
如果 properties.httpVersion 字段包含“HTTP”,则设置为“HTTP”。 |
properties.instance |
principal.hostname ,principal.asset.hostname |
如果 properties.configuration.Name 为空,则用作 principal.hostname 的值。 |
properties.message |
metadata.description |
直接从 properties.message 字段映射。 |
properties.operationName |
additional.fields[].key:"operationName", value.string_value |
直接从 properties.operationName 字段映射。 |
properties.operationStatus |
security_result.category_details |
直接从 properties.operationStatus 字段映射。如果值为“Success”或“InProgress”,则 security_result.action 设置为“ALLOW”。 |
properties.originalHost |
principal.hostname ,principal.asset.hostname |
直接从 properties.originalHost 字段映射。 |
properties.originalRequestUriWithArgs |
additional.fields[].key:"originalRequestUriWithArgs", value.string_value |
直接从 properties.originalRequestUriWithArgs 字段映射。 |
properties.receivedBytes |
network.received_bytes |
直接从 properties.receivedBytes 字段映射,转换为无符号整数。 |
properties.requestQuery |
additional.fields[].key:"requestQuery", value.string_value |
直接从 properties.requestQuery 字段映射。 |
properties.requestUri |
target.url |
直接从 properties.requestUri 字段映射。 |
properties.sentBytes |
network.sent_bytes |
直接从 properties.sentBytes 字段映射,转换为无符号整数。 |
properties.serverResponseLatency |
additional.fields[].key:"Server Response Latency", value.string_value |
直接从 properties.serverResponseLatency 字段映射。 |
properties.serverRouted |
target.ip 、target.asset.ip 、target.port |
系统使用正则表达式从 properties.serverRouted 字段中提取 IP 地址和端口。 |
properties.sslCipher |
network.tls.cipher |
直接从 properties.sslCipher 字段映射。 |
properties.sslClientCertificateIssuerName |
network.tls.server.certificate.issuer |
直接从 properties.sslClientCertificateIssuerName 字段映射。 |
properties.sslProtocol |
network.tls.version |
直接从 properties.sslProtocol 字段映射。 |
properties.timeTaken |
additional.fields[].key:"timeTaken", value.string_value |
直接从 properties.timeTaken 字段映射。 |
properties.transactionId |
network.session_id |
直接从 properties.transactionId 字段映射。 |
properties.userAgent |
network.http.user_agent ,network.http.parsed_user_agent |
直接从 properties.userAgent 字段映射。此外,该字段会转换为解析后的用户代理并映射到 network.http.parsed_user_agent 。 |
properties.WAFEvaluationTime |
additional.fields[].key:"WAFEvaluationTime", value.string_value |
直接从 properties.WAFEvaluationTime 字段映射。 |
properties.WAFMode |
additional.fields[].key:"WAFMode", value.string_value |
直接从 properties.WAFMode 字段映射。 |
resourceId |
target.resource.id |
直接从 resourceId 字段映射。 |
resourceid |
target.resource.product_object_id |
直接从 resourceid 字段映射。 |
ruleName |
security_result.rule_name |
直接从 ruleName 字段映射。 |
time /timeStamp |
metadata.event_timestamp ,timestamp |
使用 RFC 3339 或 ISO8601 格式解析为时间戳。建议使用 timeStamp ,但如果不存在 timeStamp ,则使用 time 。 |
(Parser Logic) | metadata.event_type |
如果同时存在主账号和目标账号,则设置为“NETWORK_CONNECTION”;如果仅存在主账号,则设置为“STATUS_UPDATE”;否则设置为“GENERIC_EVENT”。 |
(Parser Logic) | metadata.product_name |
设置为“Azure 网关”。 |
(Parser Logic) | metadata.vendor_name |
设置为“Microsoft”。 |
(Parser Logic) | has_principal |
一个布尔标志,如果提取了任何主要信息(主机名、IP 或端口),则设置为“true”,否则设置为“false”。 |
(Parser Logic) | has_target |
一个布尔标志,如果提取了任何目标信息(主机名、IP、端口、资源 ID 或网址),则设置为“true”;否则,设置为“false”。 |
(Parser Logic) | disambiguation_key |
从单个日志条目中提取多个事件时添加。 |
变化
2024-04-19
- 添加了对多个事件 JSON 日志的支持。
2023-12-22
- 将“resourceid”映射到“target.resource.id”。
- 将“properties.operationStatus”映射到“security_result.category_details”。
- 将“properties.configuration.Name”映射到“principal.hostname”。
- 将“properties.message”映射到“metadata.description”。
- 将“properties.configuration.RemoteStie”映射到“target.hostname”。
- 将“level”映射到“security_result.severity_details”。
- 将“properties.configuration.Ikeversion”映射到“principal.resource.attribute.labels”。
- 将“properties.configuration.LocalTunnelEndpoint”映射到“principal.ip”。
- 将“properties.configuration.RemoteTunnelEndpoint”映射到“target.ip”。
- 将“properties.configuration.LocalSubnets”“properties.configuration.RemoteSubnets”“properties.configuration.VirtualNetworkRanges”和“properties.configuration.VirtualNetworkSubnets”映射到“principal.resource.attribute.labels”。
- 将“properties.configuration.VIPAddress”映射到“principal.ip”。
- 将“properties.configuration.BgpConfiguration.GatewayConfig.PeerAddress”映射到“targrt.ip”。
- 将“properties.configuration.BgpConfiguration.GatewayConfig.PeerType”和“properties.configuration.BgpConfiguration.GatewayConfig.Asn”映射到“security_result.detection_fields”。
2023-11-16
- 新创建的解析器。