收集 Datadog 日志

支持的平台:

本文档介绍了如何将 Datadog 日志注入到 Google Security Operations。Datadog 是一个基于云的监控和分析平台,可从应用、基础架构和云服务中收集指标、跟踪记录和日志。您可以使用 Cloud Storage 或 Webhook 将 Datadog 日志共享给 Google SecOps。

准备工作

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

  • Google SecOps 实例
  • 特权用户对 Datadog 的访问权限
  • 对 Google Cloud 控制台的访问权限(用于创建 API 密钥或配置 Cloud Storage)

方法 1:通过 Cloud Storage 配置实现 Datadog 日志共享

配置 Datadog 与 Google Cloud的集成

在 Datadog 中为 Google Cloud设置集成。如需了解详情,请参阅 Datadog Google Cloud 集成设置

创建 Cloud Storage 存储桶

  1. 登录 Google Cloud 控制台。
  2. 前往 Cloud Storage 存储分区页面。

    进入“存储桶”

  3. 点击创建

  4. 创建存储桶页面上,输入您的存储桶信息。完成以下每一步后,点击继续以继续执行后续步骤:

    1. 开始使用部分中,执行以下操作:

      1. 输入符合存储桶名称要求的唯一名称(例如 datadog-data)。
      2. 如需启用分层命名空间,请点击展开箭头以展开优化文件导向型和数据密集型工作负载部分,然后选择在此存储桶上启用分层命名空间

      3. 如需添加存储桶标签,请点击展开箭头以展开标签部分。

      4. 点击添加标签,然后为标签指定键和值。

    2. 选择数据存储位置部分中,执行以下操作:

      1. 选择位置类型
      2. 使用位置类型下拉菜单选择一个位置,用于永久存储存储桶中的对象数据。
    3. 为数据选择一个存储类别部分中,为存储桶选择默认存储类别,或者选择 Autoclass 对存储桶数据进行自动存储类别管理。

    4. 选择如何控制对对象的访问权限部分中,选择强制执行禁止公开访问,然后为存储桶对象选择访问权限控制模型

    5. 选择如何保护对象数据部分中,执行以下操作:

      1. 数据保护下,选择您要为存储桶设置的任何选项。
      2. 如需选择对象数据的加密方式,请点击标有数据加密的展开箭头,然后选择数据加密方法
  5. 点击创建

创建 Google Cloud 服务账号

  1. 前往 IAM 和管理 > 服务账号
  2. 创建新服务账号。
  3. 为其指定一个描述性名称(例如,datadog-user)。
  4. 向服务账号授予您在上一步中创建的 Cloud Storage 存储桶的 Storage Object Admin 角色。
  5. 为服务账号创建密钥,然后选择 JSON 作为密钥类型。
  6. 下载服务账号的 JSON 密钥文件。请确保此文件的安全。

配置 Datadog 以将日志发送到 Cloud Storage

  1. 使用特权账号登录 Datadog。
  2. 依次前往日志 > 日志转发
  3. 点击 + 创建新归档
  4. 选择 Google Cloud Storage
  5. 输入必需参数,然后点击保存

在 Google SecOps 中配置 Feed 以注入 Cloud Storage 存储桶中的日志

  1. 依次前往 SIEM 设置 > Feed
  2. 点击添加新 Feed
  3. 在下一页上,点击配置单个 Feed
  4. Feed 名称字段中,输入 Feed 的名称(例如 Datadog Logs GCS)。
  5. 选择 Google Cloud Storage V2 作为来源类型
  6. 选择 Datadog 作为日志类型
  7. 点击获取服务账号,以获取此 Feed 的唯一服务账号。
  8. 向此服务账号授予之前创建的 Cloud Storage 存储桶的 Storage Object Viewer 角色。
  9. 点击下一步
  10. 为以下输入参数指定值:
    • 存储桶 URI:CCloud Storage 存储桶 URI,格式为 gs://datadog-data
    • 来源删除选项:根据您的偏好选择删除选项。
    • 文件存在时间上限:包含在过去指定天数内修改的文件。默认值为 180 天。
    • 资产命名空间资产命名空间
    • 提取标签:应用于此 Feed 中事件的标签。
  11. 点击下一步
  12. 最终确定界面中检查 Feed 配置,然后点击提交

方法 2:通过 Webhook 配置共享 Datadog 日志

设置 Feed

如需配置 Feed,请按以下步骤操作:

  1. 依次前往 SIEM 设置 > Feed
  2. 点击添加新 Feed
  3. 在下一页上,点击配置单个 Feed
  4. Feed 名称字段中,输入 Feed 的名称(例如 Datadog Logs)。
  5. 选择 Webhook 作为来源类型
  6. 选择 Datadog 作为日志类型
  7. 点击下一步
  8. 可选:为以下输入参数指定值:
    • 拆分定界符:用于分隔日志行的定界符,例如 \n
  9. 点击下一步
  10. 最终确定界面中检查 Feed 配置,然后点击提交
  11. 点击生成密钥,生成用于对此 Feed 进行身份验证的密钥。
  12. 复制并存储密钥。您将无法再次查看此密钥。如有需要,您可以重新生成新的 Secret 密钥,但此操作会使之前的 Secret 密钥失效。
  13. 详细信息标签页中,从端点信息字段复制 Feed 端点网址。您需要在客户端应用中指定此端点网址。
  14. 点击完成

为 webhook Feed 创建 API 密钥

  1. 前往 Google Cloud 控制台 > 凭据前往“凭据”页面
  2. 点击创建凭据,然后选择 API 密钥
  3. 将 API 密钥访问权限限制为 Chronicle API

指定端点网址

  1. 在客户端应用中,指定 webhook Feed 中提供的 HTTPS 端点网址。
  2. 通过在自定义标头中指定 API 密钥和密钥来启用身份验证,格式如下:

    X-goog-api-key = API_KEY
    X-Webhook-Access-Key = SECRET
    

    建议:将 API 密钥指定为标头,而不是在网址中指定。

  3. 如果您的 Webhook 客户端不支持自定义标头,您可以使用以下格式的查询参数指定 API 密钥和密钥:

    ENDPOINT_URL?key=API_KEY&secret=SECRET
    

    替换以下内容:

    • ENDPOINT_URL:Feed 端点网址。
    • API_KEY:用于向 Google Security Operations 进行身份验证的 API 密钥。
    • SECRET:您生成的用于验证 Feed 的密钥。

配置 Datadog 以将日志发送到网络钩子

  1. 使用特权账号登录 Datadog。
  2. 依次前往日志 > 日志转发
  3. 选择自定义目的地
  4. 点击 + 创建新目标
  5. 为以下输入参数指定值:
    • 选择目标类型:选择 HTTP
    • 为目的地命名:为网络钩子提供一个描述性名称(例如 Google SecOps Webhook)。
    • 配置目的地:粘贴 Feed ENDPOINT_网址。选择以下任一身份验证选项(不能同时选择):
      • 选项 A(推荐):保留不含凭据的网址,并将 API_KEYSECRET 作为自定义标头传递(在下一步中配置)。
      • 方案 B:以查询参数的形式将凭据附加到网址,格式为 ENDPOINT_URL?key=API_KEY&secret=SECRET。仅当客户端无法发送自定义标头时才使用此方法。
    • 配置身份验证设置:Datadog 至少需要一个身份验证标头才能保存目的地。添加以下标头。Webhook 端点会忽略此字段,因此它不会影响请求。
      • 标头名称:Authorization
      • 标头值:application/json
  6. 点击保存

UDM 映射表

日志字段 UDM 映射 逻辑
additional_field additional.fields 已合并
anonymous_label additional.fields 已合并
as_domain_label additional.fields 已合并
as_name_label additional.fields 已合并
as_number_label additional.fields 已合并
as_type_label additional.fields 已合并
auth_method_label additional.fields 已合并
category_label additional.fields 已合并
emitted_source_label additional.fields 已合并
event_type_label additional.fields 已合并
geo_continent_code_label additional.fields 已合并
geo_continent_label additional.fields 已合并
geo_continent_name_label additional.fields 已合并
geo_country_code_label additional.fields 已合并
geo_latitude_label additional.fields 已合并
geo_longitude_label additional.fields 已合并
geo_subdivision_code_label additional.fields 已合并
geo_subdivision_name_label additional.fields 已合并
geo_timezone_label additional.fields 已合并
http_level_label additional.fields 已合并
indicator_label additional.fields 已合并
indicators_matched_label additional.fields 已合并
infrastructure_label additional.fields 已合并
intention_label additional.fields 已合并
iso_code_label additional.fields 已合并
new_template_variable_name_label additional.fields 已合并
new_template_variable_preset_name_label additional.fields 已合并
new_template_variable_value_label additional.fields 已合并
new_widget_definition_background_color_label additional.fields 已合并
new_widget_definition_layout_type_label additional.fields 已合并
new_widget_definition_show_title_label additional.fields 已合并
new_widget_definition_title_label additional.fields 已合并
new_widget_definition_type_label additional.fields 已合并
new_widget_id_label additional.fields 已合并
new_widget_layout_height_label additional.fields 已合并
new_widget_layout_width_label additional.fields 已合并
new_widget_layout_x_label additional.fields 已合并
new_widget_layout_y_label additional.fields 已合并
record_attributes_asset_id_label additional.fields 已合并
record_attributes_asset_name_label additional.fields 已合并
record_attributes_asset_new_value_dashboard_definition_author_handle_label additional.fields 已合并
record_attributes_asset_new_value_dashboard_definition_author_name_label additional.fields 已合并
record_attributes_asset_new_value_dashboard_definition_description_label additional.fields 已合并
record_attributes_asset_new_value_dashboard_definition_id_label additional.fields 已合并
record_attributes_asset_new_value_dashboard_definition_reflow_type_label additional.fields 已合并
record_attributes_asset_new_value_dashboard_definition_title_label additional.fields 已合并
record_attributes_asset_new_value_dashboard_definition_url_label additional.fields 已合并
record_attributes_asset_prev_value_dashboard_definition_author_handle_label additional.fields 已合并
record_attributes_asset_prev_value_dashboard_definition_author_name_label additional.fields 已合并
record_attributes_asset_prev_value_dashboard_definition_description_label additional.fields 已合并
record_attributes_asset_prev_value_dashboard_definition_id_label additional.fields 已合并
record_attributes_asset_prev_value_dashboard_definition_reflow_type_label additional.fields 已合并
record_attributes_asset_prev_value_dashboard_definition_title_label additional.fields 已合并
record_attributes_asset_prev_value_dashboard_definition_url_label additional.fields 已合并
record_attributes_asset_type_label additional.fields 已合并
record_attributes_contextMap_cfRay_label additional.fields 已合并
record_attributes_contextMap_tradingAccountId_label additional.fields 已合并
record_attributes_evt_name_label additional.fields 已合并
record_attributes_network_client_geoip_as_number_label additional.fields 已合并
record_attributes_network_client_geoip_as_type_label additional.fields 已合并
record_attributes_network_client_geoip_location_latitude_label additional.fields 已合并
record_attributes_network_client_geoip_location_longitude_label additional.fields 已合并
record_attributes_network_client_geoip_subdivision_iso_code_label additional.fields 已合并
record_attributes_network_client_geoip_subdivision_name_label additional.fields 已合并
record_attributes_network_client_geoip_timezone_label additional.fields 已合并
record_trace_id_label additional.fields 已合并
request_id_label additional.fields 已合并
risk_label additional.fields 已合并
service_label additional.fields 已合并
source_name_label additional.fields 已合并
source_type_label additional.fields 已合并
source_url_label additional.fields 已合并
span_id_label additional.fields 已合并
symbol_label additional.fields 已合并
tag_label additional.fields 已合并
template_variable_name_label additional.fields 已合并
template_variable_preset_name_label additional.fields 已合并
template_variable_value_label additional.fields 已合并
timezone_label additional.fields 已合并
tunnels_operator_label additional.fields 已合并
tunnels_type_label additional.fields 已合并
type_label additional.fields 已合并
type_label1 additional.fields 已合并
url_details_host_label additional.fields 已合并
url_details_path_label additional.fields 已合并
user_created_timestamp_label additional.fields 已合并
widget_definition_background_color_label additional.fields 已合并
widget_definition_layout_type_label additional.fields 已合并
widget_definition_show_title_label additional.fields 已合并
widget_definition_title_label additional.fields 已合并
widget_definition_type_label additional.fields 已合并
widget_id_label additional.fields 已合并
widget_layout_height_label additional.fields 已合并
widget_layout_width_label additional.fields 已合并
widget_layout_x_label additional.fields 已合并
widget_layout_y_label additional.fields 已合并
eventMessage metadata.description 直接映射
date1 metadata.event_timestamp 解析为 ISO8601
record.date1 metadata.event_timestamp 解析为 ISO8601
event_type metadata.event_type 直接映射
has_principal metadata.event_type 映射:trueNETWORK_CONNECTIONtrueSTATUS_UPDATE
has_user metadata.event_type 已映射:trueUSER_UNCATEGORIZED
attributes._trace.origin.operation metadata.product_event_type 直接映射
eventType metadata.product_event_type 直接映射
record_attributes_contextMap_eventType metadata.product_event_type 直接映射
source metadata.product_event_type 直接映射
_id metadata.product_log_id 直接映射
record_attributes_thread_id metadata.product_log_id 直接映射
threadID metadata.product_log_id 直接映射
service metadata.product_name 直接映射
attributes.@version metadata.product_version 直接映射
attributes.http.method network.http.method 直接映射
agnt network.http.parsed_user_agent 直接映射
record_attributes_contextMap_userAgent network.http.parsed_user_agent 直接映射
attributes.http.status_code network.http.response_code 已重命名/已映射
agnt network.http.user_agent 直接映射
attributes.http.useragent network.http.user_agent 直接映射
record_attributes_contextMap_userAgent network.http.user_agent 直接映射
attributes.logger_name principal.application 直接映射
service principal.application 直接映射
attributes._trace.baggage.device_id principal.asset.asset_id 直接映射
attributes.metadata.host_metadata.hostname principal.asset.hostname 直接映射
attributes.usr.id principal.asset.hostname 直接映射
attributes.network.client.geoip.ipAddress principal.asset.ip 已合并
attributes.network.client.ip principal.asset.ip 已合并
ip1 principal.asset.ip 已合并
ipAddress principal.asset.ip 直接映射
principal_ip_address principal.asset.ip 已合并
record_attributes_network_client_ip principal.asset.ip 已合并
org principal.group.group_display_name 直接映射
attributes.org.uuid principal.group.product_object_id 直接映射
attributes.metadata.host_metadata.hostname principal.hostname 直接映射
attributes.usr.id principal.hostname 直接映射
host principal.hostname 直接映射
record_host principal.hostname 直接映射
attributes.network.client.geoip.ipAddress principal.ip 已合并
attributes.network.client.ip principal.ip 已合并
ip1 principal.ip 已合并
ipAddress principal.ip 直接映射
principal_ip_address principal.ip 已合并
record_attributes_network_client_ip principal.ip 已合并
record_attributes_http_url_details_host_label principal.labels 已合并
record_attributes_http_url_details_path_label principal.labels 已合并
record_attributes_http_useragent_label principal.labels 已合并
record_attributes_network_client_geoip_as_domain_label principal.labels 已合并
record_attributes_network_client_geoip_as_route_label principal.labels 已合并
record_attributes_network_client_geoip_city_name_label principal.labels 已合并
record_attributes_network_client_geoip_continent_code_label principal.labels 已合并
record_attributes_network_client_geoip_continent_name_label principal.labels 已合并
record_attributes_network_client_geoip_country_iso_code_label principal.labels 已合并
record_attributes_network_client_geoip_country_name_label principal.labels 已合并
record_attributes_usr_id_label principal.labels 已合并
attributes.network.client.geoip.city.name principal.location.city 直接映射
attributes.network.client.geoip.country.name principal.location.country_or_region 直接映射
port principal.port 已重命名/已映射
client_as_route_label principal.resource.attribute.labels 已合并
client_type_label principal.resource.attribute.labels 已合并
org_name_label principal.resource.attribute.labels 已合并
record_attributes_usr_uuid_label principal.user.attribute.labels 已合并
roles principal.user.attribute.roles 已合并
attributes.usr.email principal.user.email_addresses 已合并
email_id principal.user.email_addresses 已合并
record_attributes_usr_email principal.user.email_addresses 已合并
attributes.evt.actor.type principal.user.role_name 直接映射
attributes.metadata.user_uuid principal.user.userid 直接映射
attributes.usr.uuid principal.user.userid 直接映射
record_attributes_contextMap_user principal.user.userid 直接映射
user principal.user.userid 直接映射
BusArch_label security_result.about.resource.attribute.labels 已合并
CANDBVersion_label security_result.about.resource.attribute.labels 已合并
alert_label security_result.about.resource.attribute.labels 已合并
caller_label security_result.about.resource.attribute.labels 已合并
component_label security_result.about.resource.attribute.labels 已合并
esn_label security_result.about.resource.attribute.labels 已合并
ftcpVersion_label security_result.about.resource.attribute.labels 已合并
ingestMessageId_label security_result.about.resource.attribute.labels 已合并
label security_result.about.resource.attribute.labels 已合并
level_label security_result.about.resource.attribute.labels 已合并
msg_label security_result.about.resource.attribute.labels 已合并
query_label security_result.about.resource.attribute.labels 已合并
redactedVin_label security_result.about.resource.attribute.labels 已合并
updated_query_label security_result.about.resource.attribute.labels 已合并
vehicleId_label security_result.about.resource.attribute.labels 已合并
category1 security_result.category_details 已合并
_id_label security_result.detection_fields 已合并
action_label security_result.detection_fields 已合并
org_uuid_label security_result.detection_fields 已合并
record_attributes_http_method_label security_result.detection_fields 已合并
record_message_label security_result.detection_fields 已合并
record_source_label security_result.detection_fields 已合并
record_status_label security_result.detection_fields 已合并
status security_result.severity 映射:"INFO", "DEBUG", "debug", "info"LOW(?i)WARNMEDIUM
status security_result.severity_details 直接映射
context.AlertName security_result.threat_name 直接映射
src_ip_address src.ip 已合并
record_attributes_contextMap_dd_service target.application 直接映射
target_ip_address target.asset.ip 已映射:^(?:[0-9]{1,3}[.]){3}[0-9]{1,3}$target_ip_address
target_ip_address target.ip 已映射:^(?:[0-9]{1,3}[.]){3}[0-9]{1,3}$target_ip_address
record_attributes_contextMap_dd_version target.platform_version 直接映射
logger_fqcn_label target.resource.attribute.labels 已合并
logger_label target.resource.attribute.labels 已合并
modified_fields_label target.resource.attribute.labels 已合并
asset_name target.resource.name 直接映射
asset_id target.resource.product_object_id 直接映射
asset_type target.resource.type 直接映射
record_attributes_contextMap_dd_env target.resource.type 直接映射
record_attributes_contextMap_userId target.user.userid 直接映射
record_attributes_user target.user.userid 直接映射
不适用 metadata.event_type 常量:NETWORK_CONNECTION
不适用 network.http.parsed_user_agent 常量:parseduseragent
不适用 security_result.severity 常量:LOW

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