收集 Azure WAF 日志

解析器版本: 4.0

支持:

本文档介绍了如何使用 Azure 存储账号将 Azure Web 应用防火墙 (WAF) 日志导出到 Google Security Operations。解析器以 JSON 格式处理日志,并将其转换为 UDM。它会处理包含 records 数组的日志,方法是遍历每个记录并将特定字段映射到 UDM 属性。如果缺少 records 数组,解析器会将日志作为单个事件进行处理,并相应地提取和映射字段。

准备工作

确保您满足以下前提条件:

  • Google SecOps 实例
  • 有效的 Azure 租户
  • 对 Azure 的特权访问权限

配置 Azure 存储账号

  1. 在 Azure 控制台中,搜索存储账号
  2. 点击创建
  3. 为以下输入参数指定值:
    • 订阅:选择订阅。
    • 资源组:选择资源组。
    • 区域:选择区域。
    • 性能:选择性能(建议使用“标准”)。
    • 冗余:选择冗余(建议使用 GRS 或 LRS)。
    • 存储账号名称:输入新存储账号的名称。
  4. 点击 Review + create (检查 + 创建)。
  5. 查看账号概览,然后点击创建
  6. 存储账号概览 页面中,选择安全性 + 网络 中的访问密钥 子菜单。
  7. 点击 key1key2 旁边的显示
  8. 点击 Copy to clipboard (复制到剪贴板)以复制密钥。
  9. 将密钥保存在安全的位置,以供日后使用。
  10. 存储账号概览 页面中,选择设置 中的端点 子菜单。
  11. 点击 Copy to clipboard (复制到剪贴板)以复制 Blob 服务 端点网址;例如 https://<storageaccountname>.blob.core.windows.net
  12. 将端点网址保存在安全的位置,以供日后使用。

如何为 Azure WAF 日志配置日志导出

  1. 使用您的特权账号登录 Azure 门户
  2. 前往 Web 应用防火墙 (WAF) 规则 ,然后选择要监控的 WAF。
  3. 选择监控 > 诊断设置
  4. 点击 + 添加诊断设置
    • 输入诊断设置的描述性名称。
  5. 选择 allLogs
  6. 选中归档到存储账号 复选框作为目标。
    • 指定订阅存储账号
  7. 点击保存

设置 Feed

您可以通过以下两种不同的入口点在 Google SecOps 平台中设置 Feed:

  • SIEM 设置 > Feed > 添加新 Feed
  • 内容中心 > 内容包 > 开始使用

如何设置 Azure WAF Feed

  1. 点击 Azure 平台 包。
  2. 找到 Azure WAF 日志类型,然后点击添加新 Feed
  3. 为以下字段指定值:

    • 来源类型:Microsoft Azure Blob Storage V2。
    • Azure URI:Blob 端点网址。
      • ENDPOINT_URL/BLOB_NAME
        • 替换以下内容:
          • ENDPOINT_URL:Blob 端点网址 (https://<storageaccountname>.blob.core.windows.net)
          • BLOB_NAME:Blob 的名称(例如 <logname>-logs
    • 来源删除选项:根据您的注入偏好设置选择删除选项。 注意:如果您选择 Delete transferred filesDelete transferred files and empty directories 选项,请确保您已向服务帐号授予适当的权限。
    • 最长文件存在时间:包含在过去指定天数内修改的文件。默认值为 180 天。
    • 共享密钥:Azure Blob Storage 的访问密钥。 高级选项

    • Feed 名称:预先填充的值,用于标识 Feed。

    • 资产命名空间与 Feed 关联的命名空间

    • 注入标签:应用于此 Feed 中所有事件的标签。

  4. 点击创建 Feed

如需详细了解如何为此产品系列中的不同日志类型配置多个 Feed,请参阅按产品配置 Feed

UDM 映射表

日志字段 UDM 映射 逻辑
backendPoolName additional.fields[?key=='backendPoolName'].value.string_value 该值取自原始日志中的 backendPoolName 字段。
backendSettingName additional.fields[?key=='backendSettingName'].value.string_value 该值取自原始日志中的 backendSettingName 字段。
category metadata.product_event_type 该值取自原始日志中的 category 字段。
EventEnqueuedUtcTime additional.fields[?key=='EventEnqueuedUtcTime'].value.string_value 如果存在 records 字段,该值取自原始日志中的 EventEnqueuedUtcTime 字段。
EventProcessedUtcTime additional.fields[?key=='EventProcessedUtcTime'].value.string_value 如果存在 records 字段,该值取自原始日志中的 EventProcessedUtcTime 字段。
operationName additional.fields[?key=='operationName'].value.string_value 该值取自原始日志中的 operationName 字段。
properties.action additional.fields[?key=='action'].value.string_value 如果存在 records 字段,该值取自原始日志中的 properties.action 字段。
properties.action security_result.action_details 如果不存在 records 字段,该值取自原始日志中的 properties.action 字段。
properties.clientIPproperties.clientIp principal.asset.ipprincipal.ip 该值取自原始日志中的 properties.clientIPproperties.clientIp 字段,优先使用 clientIP
properties.clientPort principal.port 该值取自原始日志中的 properties.clientPort 字段。
properties.clientResponseTime principal.resource.attribute.labels[?key=='Client Response Time'].value 如果不存在 records 字段,该值取自原始日志中的 properties.clientResponseTime 字段。
properties.details.data additional.fields[?key=='Properties data'].value.string_value 如果存在 records 字段,该值取自原始日志中的 properties.details.data 字段。
properties.details.file principal.process.file.full_path 如果不存在 records 字段,该值取自原始日志中的 properties.details.file 字段。
properties.details.matches[].matchVariableNameproperties.details.matches[].matchVariableValue additional.fields[?key.startsWith('%{idx} ')].value.string_value 该值取自原始日志中的 properties.details.matches 数组。UDM 中的 key 是使用索引 (idx) 和 matchVariableName 构建的。value 取自 matchVariableValue
properties.details.message metadata.description 该值取自原始日志中的 properties.details.message 字段,并移除了反斜线和引号。
properties.details.msg metadata.description 如果存在 records 字段,该值取自原始日志中的 properties.details.msg 字段。
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.hostproperties.hostnameproperties.originalHost principal.asset.hostnameprincipal.hostname 该值取自 properties.originalHostproperties.hostproperties.hostname 中的一个,并按此顺序优先使用。
properties.policyId security_result.detection_fields[?key=='policyId'].value 该值取自原始日志中的 properties.policyId 字段。
properties.policyMode security_result.detection_fields[?key=='policyMode'].value 如果存在 records 字段,该值取自原始日志中的 properties.policyMode 字段。
properties.policy additional.fields[?key=='Properties policy'].value.string_value 如果存在 records 字段,该值取自原始日志中的 properties.policy 字段。
properties.receivedBytes network.received_bytes 该值取自原始日志中的 properties.receivedBytes 字段。
properties.requestUri target.url 该值取自原始日志中的 properties.requestUri 字段。
properties.ruleId security_result.rule_id 该值取自原始日志中的 properties.ruleId 字段。
properties.ruleName security_result.rule_name 如果存在 records 字段,该值取自原始日志中的 properties.ruleName 字段。
properties.ruleNameruleSetType security_result.rule_name 如果不存在 records 字段,该值取自原始日志中的 properties.ruleName 字段,如果该字段为空,则取自 ruleSetType 字段。
properties.ruleSetVersion security_result.detection_fields[?key=='ruleSetVersion'].value 该值取自原始日志中的 properties.ruleSetVersion 字段。
properties.sentBytes network.sent_bytes 该值取自原始日志中的 properties.sentBytes 字段。
properties.serverResponseLatency additional.fields[?key=='Server Response Latency'].value.string_value 如果不存在 records 字段,该值取自原始日志中的 properties.serverResponseLatency 字段。
properties.serverRouted target.asset.iptarget.iptarget.port IP 和端口取自 properties.serverRouted 字段。
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=='Properties Timetaken'].value.string_value 如果不存在 records 字段,该值取自原始日志中的 properties.timeTaken 字段。
properties.trackingReference additional.fields[?key=='trackingReference'].value.string_value 如果存在 records 字段,该值取自原始日志中的 properties.trackingReference 字段。
properties.transactionId network.session_id 该值取自原始日志中的 properties.transactionId 字段。
properties.userAgent network.http.user_agent 该值取自原始日志中的 properties.userAgent 字段。
properties.WAFEvaluationTime additional.fields[?key=='Properties WAFEvaluationTime'].value.string_value 如果不存在 records 字段,该值取自原始日志中的 properties.WAFEvaluationTime 字段。
properties.WAFMode additional.fields[?key=='Properties WAFMode'].value.string_value 如果不存在 records 字段,该值取自原始日志中的 properties.WAFMode 字段。
rec.category metadata.product_event_type 如果存在 records 字段,该值取自原始日志中的 rec.category 字段。
rec.operationName additional.fields[?key=='operationName'].value.string_value 如果存在 records 字段,该值取自原始日志中的 rec.operationName 字段。
rec.properties.clientIPrec.properties.clientIp principal.asset.ipprincipal.ip 如果存在 records 字段,该值取自原始日志中的 rec.properties.clientIPrec.properties.clientIp 字段,优先使用 clientIP
rec.properties.clientPort principal.port 如果存在 records 字段,该值取自原始日志中的 rec.properties.clientPort 字段。
rec.properties.host principal.asset.hostnameprincipal.hostname 如果存在 records 字段,该值取自原始日志中的 rec.properties.host 字段。
rec.properties.policy additional.fields[?key=='Properties policy'].value.string_value 如果存在 records 字段,该值取自原始日志中的 rec.properties.policy 字段。
rec.properties.requestUri target.url 如果存在 records 字段,该值取自原始日志中的 rec.properties.requestUri 字段。
rec.properties.ruleName security_result.rule_name 如果存在 records 字段,该值取自原始日志中的 rec.properties.ruleName 字段。
rec.properties.trackingReference additional.fields[?key=='trackingReference'].value.string_value 如果存在 records 字段,该值取自原始日志中的 rec.properties.trackingReference 字段。
rec.resourceId target.resource.id 如果存在 records 字段,该值取自原始日志中的 rec.resourceId 字段。
rec.time metadata.event_timestamp 如果存在 records 字段,该值取自原始日志中的 rec.time 字段。
resourceId target.resource.id 如果不存在 records 字段,该值取自原始日志中的 resourceId 字段。
timeStamp metadata.event_timestamp 如果不存在 records 字段,该值取自原始日志中的 timeStamp 字段。
不适用 metadata.event_type 如果同时存在正文(主机名或客户端 IP)和目标 IP,则该值设置为 NETWORK_CONNECTION。如果存在正文但缺少目标 IP,则该值设置为 STATUS_UPDATE。否则,该值默认为 GENERIC_EVENTevent_type 字段的值。
不适用 metadata.log_type 该值硬编码为 AZURE_WAF
不适用 metadata.product_name 该值硬编码为 Azure WAF Logs
不适用 metadata.vendor_name 该值硬编码为 Microsoft
不适用 security_result.action 如果 properties.actionMatched,则该值设置为 ALLOW;如果 properties.actionBlock,则该值设置为 BLOCK

更新日志

查看此解析器的更新日志

需要更多帮助?获得社区成员和 Google SecOps 专业人士的解答。