收集 ntopng 日志

支持:

此解析器可提取 SYSLOG 或 JSON 格式的 ntopng 网络监控日志。它会解析日志消息,将相关字段转换为 UDM 格式,并使用产品和供应商名称等元数据丰富事件。解析器还会处理嵌套的 JSON 结构,并将特定的 ntopng 字段映射到 UDM 网络事件,包括流量提醒和用户资源访问。

准备工作

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

  • Google SecOps 实例。
  • 对 ntopng 的特权访问权限。

设置 Feed

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

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

为 webhook Feed 创建 API 密钥

  1. 前往 Google Cloud 控制台 > 凭据。

    转到“凭据”页面

  2. 点击创建凭据,然后选择 API 密钥。

  3. 限制对 Google Security Operations API 的 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 而生成的密钥。

在 ntopng 上为 Google SecOps 配置 Webhook

  1. 登录 ntopng 网页界面。
  2. 从下拉菜单中选择系统菜单。
  3. 依次前往通知 > 端点。
  4. 点击 添加 。
  5. 为以下输入参数指定值:
    • 端点名称:提供一个具有描述性的唯一名称(例如 Google SecOps)。
    • 端点类型:从列表中选择 Webhook。
    • 网络钩子网址:输入 Google SecOps ENDPOINT_URL,其中包含 API_KEY 和 SECRET。
  6. 点击 Add(添加)。
  7. 依次前往通知 > 接收者。
  8. 点击 添加 。
  9. 为以下输入参数指定值:
    • Recipient Name(收件人名称):提供一个独一无二的描述性名称(例如 Google SecOps)。
    • 选择端点:选择之前创建的端点。
    • 严重程度:选择要发送给 Google SecOps 的严重程度(例如信息、警告和错误)。
    • 类别过滤条件:选择要发送到 Google SecOps 的内容。
  10. 点击测试收件人以验证连接。
  11. 点击添加以保存 webhook。

配置 ntopng 网络钩子资源订阅者

  1. 前往池。
  2. 选择要分享其事件的资源。

  3. 点击操作列中的铅笔图标。

  4. 点击收件人下拉菜单。

  5. 选择 Google SecOps Webhook 收件人。

  6. 点击修改以保存配置。

  7. 对其他资源重复此过程。

UDM 映射表

日志字段 UDM 映射 逻辑
action security_result.detection_fields.key=action,security_result.detection_fields.value=%{action} 原始日志中的 action 值会映射到键为“action”的 security_result.detection_fields 对象。
alert_generation.host_info.broadcast_domain_host security_result.detection_fields.key=host_info broadcast_domain_host,security_result.detection_fields.value=%{alert_generation.host_info.broadcast_domain_host} 嵌套 JSON 中的 alert_generation.host_info.broadcast_domain_host 值会映射到键为“host_info broadcast_domain_host”的 security_result.detection_fields 对象。
alert_generation.host_info.dhcpHost security_result.detection_fields.key=host_info dhcpHost,security_result.detection_fields.value=%{alert_generation.host_info.dhcpHost} 嵌套 JSON 中的 alert_generation.host_info.dhcpHost 值会映射到键为“host_info dhcpHost”的 security_result.detection_fields 对象。
alert_generation.host_info.is_blacklisted security_result.detection_fields.key=host_info is_blacklisted,security_result.detection_fields.value=%{alert_generation.host_info.is_blacklisted} 嵌套 JSON 中的 alert_generation.host_info.is_blacklisted 值会映射到键为“host_info is_blacklisted”的 security_result.detection_fields 对象。
alert_generation.host_info.is_broadcast security_result.detection_fields.key=host_info is_broadcast,security_result.detection_fields.value=%{alert_generation.host_info.is_broadcast} 嵌套 JSON 中的 alert_generation.host_info.is_broadcast 值会映射到键为“host_info is_broadcast”的 security_result.detection_fields 对象。
alert_generation.host_info.is_multicast security_result.detection_fields.key=host_info is_multicast,security_result.detection_fields.value=%{alert_generation.host_info.is_multicast} 嵌套 JSON 中的 alert_generation.host_info.is_multicast 值会映射到键为“host_info is_multicast”的 security_result.detection_fields 对象。
alert_generation.host_info.localhost security_result.detection_fields.key=host_info localhost,security_result.detection_fields.value=%{alert_generation.host_info.localhost} 嵌套 JSON 中的 alert_generation.host_info.localhost 值会映射到键为“host_info localhost”的 security_result.detection_fields 对象。
alert_generation.host_info.privatehost security_result.detection_fields.key=host_info privatehost,security_result.detection_fields.value=%{alert_generation.host_info.privatehost} 嵌套 JSON 中的 alert_generation.host_info.privatehost 值会映射到键为“host_info privatehost”的 security_result.detection_fields 对象。
alert_generation.host_info.systemhost security_result.detection_fields.key=host_info systemhost,security_result.detection_fields.value=%{alert_generation.host_info.systemhost} 嵌套 JSON 中的 alert_generation.host_info.systemhost 值会映射到键为“host_info systemhost”的 security_result.detection_fields 对象。
alert_generation.script_key security_result.category_details=%{alert_generation.script_key} 嵌套 JSON 中的 alert_generation.script_key 值会映射到 security_result.category_details。
alert_generation.subdir security_result.detection_fields.key=alert_generation_subdir,security_result.detection_fields.value=%{alert_generation.subdir} 嵌套 JSON 中的 alert_generation.subdir 值会映射到键为“alert_generation_subdir”的 security_result.detection_fields 对象。
alert_id security_result.detection_fields.key=alert_id,security_result.detection_fields.value=%{alert_id} 原始日志中的 alert_id 值会映射到键为“alert_id”的 security_result.detection_fields 对象。
alerts_map security_result.detection_fields.key=alerts_map,security_result.detection_fields.value=%{alerts_map} 原始日志中的 alerts_map 值会映射到键为“alerts_map”的 security_result.detection_fields 对象。
cli2srv_bytes network.sent_bytes 原始日志中的 cli2srv_bytes 值会转换为无符号整数并映射到 network.sent_bytes。
cli_asn principal.resource.attribute.labels.key=cli_asn,principal.resource.attribute.labels.value=%{cli_asn} 原始日志中的 cli_asn 值会转换为字符串,并映射到键为“cli_asn”的 principal.resource.attribute.labels 对象。
cli_blacklisted principal.resource.attribute.labels.key=cli_blacklisted,principal.resource.attribute.labels.value=%{cli_blacklisted} 原始日志中的 cli_blacklisted 值会转换为字符串,并映射到键为“cli_blacklisted”的 principal.resource.attribute.labels 对象。
cli_city_name principal.location.city 原始日志中的 cli_city_name 值会映射到 principal.location.city。
cli_continent_name principal.resource.attribute.labels.key=cli_continent_name,principal.resource.attribute.labels.value=%{cli_continent_name} 原始日志中的 cli_continent_name 值会映射到具有键“cli_continent_name”的 principal.resource.attribute.labels 对象。
cli_country_name principal.location.country_or_region 原始日志中的 cli_country_name 值会映射到 principal.location.country_or_region。
cli_host_pool_id principal.resource.attribute.labels.key=cli_host_pool_id,principal.resource.attribute.labels.value=%{cli_host_pool_id} 原始日志中 cli_host_pool_id 的值会转换为字符串,并映射到键为“cli_host_pool_id”的 principal.resource.attribute.labels 对象。
cli_ip principal.ip,principal.asset.ip 原始日志中的 cli_ip 值会映射到 principal.ip 和 principal.asset.ip。
cli_localhost principal.resource.attribute.labels.key=cli_localhost,principal.resource.attribute.labels.value=%{cli_localhost} 原始日志中的 cli_localhost 值会转换为字符串,并映射到键为“cli_localhost”的 principal.resource.attribute.labels 对象。
cli_location principal.location.name 原始日志中的 cli_location 值会转换为字符串。如果不是“0”,则映射到 principal.location.name。
cli_name principal.hostname,principal.asset.hostname 原始日志中的 cli_name 值会映射到 principal.hostname 和 principal.asset.hostname。
cli_network principal.resource.attribute.labels.key=cli_network,principal.resource.attribute.labels.value=%{cli_network} 原始日志中的 cli_network 值会转换为字符串,并映射到键为“cli_network”的 principal.resource.attribute.labels 对象。
cli_port principal.port 原始日志中的 cli_port 值会转换为整数并映射到 principal.port。
entity_id principal.resource.attribute.labels.key=entity_id,principal.resource.attribute.labels.value=%{entity_id} 原始日志中的 entity_id 值会转换为字符串,并映射到键为“entity_id”的 principal.resource.attribute.labels 对象。
entity_val principal.resource.attribute.labels.key=entity_val,principal.resource.attribute.labels.value=%{entity_val} 除非 的值等于 ip 的值,否则原始日志中 entity_val 的值会映射到键为“entity_val”的 principal.resource.attribute.labels 对象。
event.type metadata.event_type 由解析器逻辑根据是否存在 principal、target 和 network 字段来确定。可能的值:NETWORK_FLOW、NETWORK_UNCATEGORIZED、USER_RESOURCE_ACCESS、GENERIC_EVENT。
first_seen principal.asset.first_seen_time 原始日志中的 first_seen 值会转换为字符串,解析为自纪元以来的毫秒数,并映射到 principal.asset.first_seen_time。
flow_risk_bitmap security_result.detection_fields.key=flow_risk_bitmap,security_result.detection_fields.value=%{flow_risk_bitmap} 原始日志中的 flow_risk_bitmap 值会转换为字符串,并映射到键为“flow_risk_bitmap”的 security_result.detection_fields 对象。
granularity security_result.detection_fields.key=granularity,security_result.detection_fields.value=%{granularity} 原始日志中的 granularity 值会转换为字符串,并映射到键为“granularity”的 security_result.detection_fields 对象。
hash_entry_id security_result.detection_fields.key=hash_entry_id,security_result.detection_fields.value=%{hash_entry_id} 嵌套 JSON 中的 hash_entry_id 值会映射到键为“hash_entry_id”的 security_result.detection_fields 对象。
host_ip principal.ip,principal.asset.ip 从消息的 <INT>Oct 20 15:34:53 1.1.1.1 部分提取的 IP 地址会映射到 principal.ip 和 principal.asset.ip。
ifid principal.asset_id 原始日志中的 ifid 值会转换为字符串,并映射到 principal.asset_id,前缀为“ifid: ”。
ip principal.ip、principal.asset.ip 或 target.ip,target.asset.ip 如果 is_client 为 true,则原始日志中的 ip 值会映射到 principal.ip 和 principal.asset.ip。如果 is_server 为 true,则映射到 target.ip 和 target.asset.ip。
is_cli_attacker security_result.detection_fields.key=is_cli_attacker,security_result.detection_fields.value=%{is_cli_attacker} 原始日志中 is_cli_attacker 的值会转换为字符串,并映射到键为“is_cli_attacker”的 security_result.detection_fields 对象。
is_cli_victim security_result.detection_fields.key=is_cli_victim,security_result.detection_fields.value=%{is_cli_victim} 原始日志中的 is_cli_victim 值会转换为字符串,并映射到键为“is_cli_victim”的 security_result.detection_fields 对象。
is_flow_alert security_result.detection_fields.key=is_flow_alert、security_result.detection_fields.value=%{is_flow_alert}、security_result.detection_fields.key=alert type、security_result.detection_fields.value=flow 原始日志中的 is_flow_alert 值会转换为字符串,并映射到键为“is_flow_alert”的 security_result.detection_fields 对象。如果 is_flow_alert 为 true,系统还会创建一个 security_result.detection_fields 对象,其键为“alert type”,值为“flow”。
is_srv_attacker security_result.detection_fields.key=is_srv_attacker,security_result.detection_fields.value=%{is_srv_attacker} 原始日志中的 is_srv_attacker 值会转换为字符串,并映射到键为“is_srv_attacker”的 security_result.detection_fields 对象。
is_srv_victim security_result.detection_fields.key=is_srv_victim,security_result.detection_fields.value=%{is_srv_victim} 原始日志中的 is_srv_victim 值会转换为字符串,并映射到键为“is_srv_victim”的 security_result.detection_fields 对象。
metadata.product_name metadata.product_name=NTOPNG 硬编码为“NTOPNG”。
metadata.vendor_name metadata.vendor_name=%{vendor_name} 消息中的 vendor_name 值会映射到 metadata.vendor_name。
name principal.hostname、principal.asset.hostname 或 target.hostname,target.asset.hostname 如果 is_client 为 true,则原始日志中的 name 值会映射到 principal.hostname 和 principal.asset.hostname。如果 is_server 为 true,则会映射到 target.hostname 和 target.asset.hostname。
ntopng_key security_result.detection_fields.key=ntopng_key,security_result.detection_fields.value=%{ntopng_key} 嵌套 JSON 中的 ntopng.key(重命名为 ntopng_key)的值会映射到键为“ntopng_key”的 security_result.detection_fields 对象。
observation_point_id observer.asset_id 原始日志中的 observation_point_id 值会转换为字符串。如果不是“0”,则会映射到 observer.asset_id,并带有前缀“id:”。
pool_id principal.resource.attribute.labels.key=pool_id,principal.resource.attribute.labels.value=%{pool_id} 原始日志中的 pool_id 值会转换为字符串,并映射到键为“pool_id”的 principal.resource.attribute.labels 对象。
probe_ip intermediary.ip 原始日志中的 probe_ip 值会映射到 intermediary.ip。
proto.confidence security_result.confidence_details 原始日志中的 proto.confidence 值会转换为字符串,并映射到 security_result.confidence_details。
proto.http.last_method network.http.method 原始日志中的 proto.http.last_method 值会映射到 network.http.method。
proto.http.last_return_code network.http.response_code 原始日志中的 proto.http.last_return_code 值会转换为整数,并映射到 network.http.response_code。
proto.http.last_server_name network.tls.client.server_name 原始日志中的 proto.http.server_name 值会映射到 network.tls.client.server_name。
proto.http.last_url network.http.referral_url 原始日志中的 proto.http.last_url 值会映射到 network.http.referral_url。
proto.http.last_user_agent network.http.user_agent 原始日志中的 proto.http.last_user_agent 值会映射到 network.http.user_agent。
proto.http.server_name network.tls.client.server_name 原始日志中的 proto.http.server_name 值会映射到 network.tls.client.server_name。
proto.l4 network.ip_protocol 原始日志中的 proto.l4 值会映射到 network.ip_protocol。
proto_ndpi additional.fields.key=proto ndpi、additional.fields.value.string_value=%{proto_ndpi}、network.application_protocol 原始日志中 proto.ndpi(已重命名为 proto_ndpi)的值会映射到键为“proto ndpi”的 additional.fields 对象。它还用于根据“NTP”和“HTTP”等关键字确定 network.application_protocol 的值。
proto_ndpi_app principal.application 原始日志中的 proto_ndpi_app 值会映射到 principal.application。
proto_ndpi_breed security_result.detection_fields.key=proto_ndpi_breed,security_result.detection_fields.value=%{proto_ndpi_breed} 原始日志中的 proto_ndpi_breed 值会转换为字符串,并映射到键为“proto_ndpi_breed”的 security_result.detection_fields 对象。
proto_ndpi_cat security_result.category_details 原始日志中的 proto_ndpi_cat 值会映射到 security_result.category_details。
proto_ndpi_cat_id security_result.detection_fields.key=proto_ndpi_cat_id,security_result.detection_fields.value=%{proto_ndpi_cat_id} 原始日志中的 proto_ndpi_cat_id 值会转换为字符串,并映射到键为“proto_ndpi_cat_id”的 security_result.detection_fields 对象。
score security_result.detection_fields.key=score,security_result.detection_fields.value=%{score} 原始日志中的 score 值会转换为字符串,并映射到键为“score”的 security_result.detection_fields 对象。
srv2cli_bytes network.received_bytes 原始日志中的 srv2cli_bytes 值会转换为无符号整数并映射到 network.received_bytes。
srv_asn target.resource.attribute.labels.key=srv_asn,target.resource.attribute.labels.value=%{srv_asn} 原始日志中的 srv_asn 值会转换为字符串,并映射到键为“srv_asn”的 target.resource.attribute.labels 对象。
srv_blacklisted target.resource.attribute.labels.key=srv_blacklisted,target.resource.attribute.labels.value=%{srv_blacklisted} 原始日志中 srv_blacklisted 的值会转换为字符串,并映射到键为“srv_blacklisted”的 target.resource.attribute.labels 对象。
srv_city_name target.location.city 原始日志中的 srv_city_name 值会映射到 target.location.city。
srv_continent_name target.resource.attribute.labels.key=srv_continent_name,target.resource.attribute.labels.value=%{srv_continent_name} 原始日志中的 srv_continent_name 值会映射到键为“srv_continent_name”的 target.resource.attribute.labels 对象。
srv_country_name target.location.country_or_region 原始日志中的 srv_country_name 值会映射到 target.location.country_or_region。
srv_host_pool_id target.resource.attribute.labels.key=srv_host_pool_id,target.resource.attribute.labels.value=%{srv_host_pool_id} 原始日志中的 srv_host_pool_id 值会转换为字符串,并映射到键为“srv_host_pool_id”的 target.resource.attribute.labels 对象。
srv_ip target.ip,target.asset.ip 原始日志中的 srv_ip 值会映射到 target.ip 和 target.asset.ip。
srv_localhost target.resource.attribute.labels.key=srv_localhost,target.resource.attribute.labels.value=%{srv_localhost} 原始日志中 srv_localhost 的值会转换为字符串,并映射到键为“srv_localhost”的 target.resource.attribute.labels 对象。
srv_location target.location.name 原始日志中的 srv_location 值会转换为字符串。如果不是“0”,则映射到 target.location.name。
srv_location_lat target.location.region_coordinates.latitude 原始日志中的 srv_location_lat 值会映射到 target.location.region_coordinates.latitude。
srv_location_lon target.location.region_coordinates.longitude 原始日志中的 srv_location_lon 值会映射到 target.location.region_coordinates.longitude。
srv_name target.hostname,target.asset.hostname 原始日志中的 srv_name 值会映射到 target.hostname 和 target.asset.hostname。
srv_network target.resource.attribute.labels.key=srv_network,target.resource.attribute.labels.value=%{srv_network} 原始日志中 srv_network 的值会转换为字符串,并映射到键为“srv_network”的 target.resource.attribute.labels 对象。
srv_port target.port 原始日志中的 srv_port 值会转换为整数,并映射到 target.port。
tstamp additional.fields.key=tstamp,additional.fields.value.string_value=%{tstamp} 原始日志中的 tstamp 值会转换为字符串,并映射到键为“tstamp”的 additional.fields 对象。
vlan_id principal.resource.attribute.labels.key=vlan_id,principal.resource.attribute.labels.value=%{vlan_id} 原始日志中的 vlan_id 值会转换为字符串,并映射到键为“vlan_id”的 principal.resource.attribute.labels 对象。
when metadata.event_timestamp 原始日志中的 when 值会被解析为时间戳并映射到 metadata.event_timestamp。

更新日志

查看相应解析器的更新日志

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