收集 ntopng 日志

支持的语言:

概览

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

准备工作

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

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

设置 Feed

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

  • SIEM 设置 > Feed
  • 内容中心 > 内容包

通过“SIEM 设置”>“Feed”设置 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. 复制并存储密钥。您将无法再次查看此密钥。如有需要,您可以重新生成新的 Secret 密钥,但此操作会使之前的 Secret 密钥失效。
  13. 详情标签页中,从端点信息字段复制 Feed 端点网址。您需要在客户端应用中指定此端点网址。
  14. 点击完成

设置来自内容中心的 Feed

为以下字段指定值:

  • 拆分分隔符:用于分隔日志行的分隔符,例如 \n

高级选项

  • Feed 名称:用于标识 Feed 的预填充值。
  • 来源类型:用于将日志收集到 Google SecOps 中的方法。
  • 资源命名空间:与 Feed 关联的命名空间。
  • 提取标签:应用于相应 Feed 中所有事件的标签。

  • 点击生成密钥,生成用于对此 Feed 进行身份验证的密钥。

  • 复制并存储密钥。您将无法再次查看此密钥。如有需要,您可以重新生成新的 Secret 密钥,但此操作会使之前的 Secret 密钥失效。

  • 详情标签页中,从端点信息字段复制 Feed 端点网址。您需要在客户端应用中指定此端点网址。

为 Webhook Feed 创建 API 密钥

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

    转到“凭证”页面

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

  3. 将 API 密钥访问权限限制为 Google Security Operations 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
    • Webhook 网址:输入包含 API_KEYSECRET 的 Google SecOps ENDPOINT_网址
  6. 点击添加
  7. 依次前往通知 > 接收者
  8. 点击 添加
  9. 为以下输入参数指定值:
    • 收件人名称:提供独一无二的描述性名称(例如 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=actionsecurity_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_hostsecurity_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 dhcpHostsecurity_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_blacklistedsecurity_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_broadcastsecurity_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_multicastsecurity_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 localhostsecurity_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 privatehostsecurity_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 systemhostsecurity_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_subdirsecurity_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_idsecurity_result.detection_fields.value=%{alert_id} 原始日志中的 alert_id 值会映射到键为“alert_id”的 security_result.detection_fields 对象。
alerts_map security_result.detection_fields.key=alerts_mapsecurity_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_asnprincipal.resource.attribute.labels.value=%{cli_asn} 原始日志中的 cli_asn 值会转换为字符串,并映射到键为“cli_asn”的 principal.resource.attribute.labels 对象。
cli_blacklisted principal.resource.attribute.labels.key=cli_blacklistedprincipal.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_nameprincipal.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_idprincipal.resource.attribute.labels.value=%{cli_host_pool_id} 原始日志中的 cli_host_pool_id 值会转换为字符串,并映射到键为“cli_host_pool_id”的 principal.resource.attribute.labels 对象。
cli_ip principal.ipprincipal.asset.ip 原始日志中的 cli_ip 值会映射到 principal.ipprincipal.asset.ip
cli_localhost principal.resource.attribute.labels.key=cli_localhostprincipal.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.hostnameprincipal.asset.hostname 原始日志中的 cli_name 值会映射到 principal.hostnameprincipal.asset.hostname
cli_network principal.resource.attribute.labels.key=cli_networkprincipal.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_idprincipal.resource.attribute.labels.value=%{entity_id} 原始日志中的 entity_id 值会转换为字符串,并映射到键为“entity_id”的 principal.resource.attribute.labels 对象。
entity_val principal.resource.attribute.labels.key=entity_valprincipal.resource.attribute.labels.value=%{entity_val} 原始日志中的 entity_val 值会映射到键为“entity_val”的 principal.resource.attribute.labels 对象,除非该值等于 ip 的值。
event.type metadata.event_type 由解析器逻辑根据 principaltargetnetwork 字段的存在情况确定。可能的值:NETWORK_FLOWNETWORK_UNCATEGORIZEDUSER_RESOURCE_ACCESSGENERIC_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_bitmapsecurity_result.detection_fields.value=%{flow_risk_bitmap} 原始日志中的 flow_risk_bitmap 值会转换为字符串,并映射到键为“flow_risk_bitmap”的 security_result.detection_fields 对象。
granularity security_result.detection_fields.key=granularitysecurity_result.detection_fields.value=%{granularity} 原始日志中的 granularity 值会转换为字符串,并映射到键为“granularity”的 security_result.detection_fields 对象。
hash_entry_id security_result.detection_fields.key=hash_entry_idsecurity_result.detection_fields.value=%{hash_entry_id} 嵌套 JSON 中的 hash_entry_id 值会映射到键为“hash_entry_id”的 security_result.detection_fields 对象。
host_ip principal.ipprincipal.asset.ip 从消息的 <INT>Oct 20 15:34:53 1.1.1.1 部分提取的 IP 地址会映射到 principal.ipprincipal.asset.ip
ifid principal.asset_id 原始日志中的 ifid 值会转换为字符串,并映射到 principal.asset_id,前缀为“ifid: ”。
ip principal.ipprincipal.asset.iptarget.iptarget.asset.ip 如果 is_client 为 true,则原始日志中的 ip 值会映射到 principal.ipprincipal.asset.ip。如果 is_server 为 true,则映射到 target.iptarget.asset.ip
is_cli_attacker security_result.detection_fields.key=is_cli_attackersecurity_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_victimsecurity_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_alertsecurity_result.detection_fields.value=%{is_flow_alert}security_result.detection_fields.key=alert typesecurity_result.detection_fields.value=flow 原始日志中的 is_flow_alert 值会转换为字符串,并映射到键为“is_flow_alert”的 security_result.detection_fields 对象。如果 is_flow_alert 为 true,系统还会创建一个键为“alert type”、值为“flow”的 security_result.detection_fields 对象。
is_srv_attacker security_result.detection_fields.key=is_srv_attackersecurity_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_victimsecurity_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.hostnameprincipal.asset.hostnametarget.hostnametarget.asset.hostname 如果 is_client 为 true,则原始日志中的 name 值会映射到 principal.hostnameprincipal.asset.hostname。如果 is_server 为 true,则映射到 target.hostnametarget.asset.hostname
ntopng_key security_result.detection_fields.key=ntopng_keysecurity_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_idprincipal.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 ndpiadditional.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_breedsecurity_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_idsecurity_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=scoresecurity_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_asntarget.resource.attribute.labels.value=%{srv_asn} 原始日志中的 srv_asn 值会转换为字符串,并映射到键为“srv_asn”的 target.resource.attribute.labels 对象。
srv_blacklisted target.resource.attribute.labels.key=srv_blacklistedtarget.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_nametarget.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_idtarget.resource.attribute.labels.value=%{srv_host_pool_id} 原始日志中的 srv_host_pool_id 值会转换为字符串,并映射到键为“srv_host_pool_id”的 target.resource.attribute.labels 对象。
srv_ip target.iptarget.asset.ip 原始日志中的 srv_ip 值会映射到 target.iptarget.asset.ip
srv_localhost target.resource.attribute.labels.key=srv_localhosttarget.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.hostnametarget.asset.hostname 原始日志中的 srv_name 值会映射到 target.hostnametarget.asset.hostname
srv_network target.resource.attribute.labels.key=srv_networktarget.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=tstampadditional.fields.value.string_value=%{tstamp} 原始日志中的 tstamp 值会转换为字符串,并映射到键为“tstamp”的 additional.fields 对象。
vlan_id principal.resource.attribute.labels.key=vlan_idprincipal.resource.attribute.labels.value=%{vlan_id} 原始日志中的 vlan_id 值会转换为字符串,并映射到键为“vlan_id”的 principal.resource.attribute.labels 对象。
when metadata.event_timestamp 原始日志中的 when 值会被解析为时间戳并映射到 metadata.event_timestamp

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