将指标函数用于风险分析规则

支持的国家/地区:

本文档介绍了 YARA-L 2.0 语法功能的主要元素,这些功能专为风险分析而设计。其中详细介绍了如何使用专门的指标函数来汇总大量历史数据,从而实现更复杂的检测和风险评分。如需详细了解 YARA-L,请参阅 YARA-L 2.0 概览。

Google Security Operations 支持多种指标函数,这些函数可以汇总大量历史数据。所有使用指标函数的规则都会自动归类为多事件规则,即使它们没有 match 部分且仅使用一个事件变量也是如此。这意味着,它们会计入多事件规则配额。

指标函数参数

您可以将指标函数用于执行实体行为分析的规则。

示例:计算每个 IP 的每日出站字节数上限

以下示例演示了一条规则,该规则用于计算特定 IP 地址在过去一个月内每天发送的最大字节数。在本例中,IP 地址由占位符变量 ($ip) 表示。详细了解占位符变量。

$max_bytes_per_day = max(metrics.network_bytes_outbound(
    period:1d, window:30d,
    metric:value_sum,
    agg:max,
    principal.asset.ip:$ip
))

由于这些函数中使用了大量实参,因此该示例使用了具名形参,这些形参可以按任意顺序指定。具体参数如下所示:

时段

将各个日志事件合并为一个观察结果的时长。仅允许使用 1h 和 1d。

窗口

将各个观察结果汇总为一个值(例如平均值和最大值)的时长。window 的允许值取决于指标的周期。有效映射如下:

period:1h:window:today

period:1d:window:30d

示例:确定特定用户每日身份验证失败次数的峰值

示例:识别特定用户每日失败身份验证的峰值 以下示例演示了一条规则,该规则可识别在 30 天 (30d) 回溯期内,特定用户 (alice) 在一天 (1d) 内记录的身份验证尝试失败次数 (max(metrics.auth_attempts_fail) 的最大值:

$user = "alice"
$max_fail = max(metrics.auth_attempts_fail(
    period:1d, window:30d,
        metric:event_count_sum,
        agg:max,
        target.user.userid:$user
))

示例:使用每小时和每日指标检测首次出现的用户登录

以下示例演示了如何结合使用每小时和每日指标函数来识别“首次出现”的行为。此规则通过检查当天的小时增量和更广泛的 30 天历史时间范围,来确定用户是否首次登录特定应用。

events:
    $e.metadata.event_type = "USER_LOGIN"
    $e.security_result.action = "ALLOW"
    $userid = $e.target.user.userid
    $app = $e.target.application
match:
    // find events from now - 4h ago, which is the recommended look-back period
    $userid, $app over 4h
outcome:
    // check hourly analytics until daily analytics are available
    $first_seen_today = max(metrics.auth_attempts_success(
        period:1h, window:today, metric:first_seen, agg:max,
        target.user.userid:$userid, target.application:$app))
    $first_seen_monthly = max(metrics.auth_attempts_success(
        period:1d, window:30d, metric:first_seen, agg:max,
        target.user.userid:$userid, target.application:$app))
condition:
    $e and ($first_seen_today = 0) and ($first_seen_monthly = 0)

指标

在每个周期内,每个观察结果都有许多与之相关的指标。 您必须选择其中一个指标,以便聚合整个窗口期内的数据。支持五种 metric 类型:

  • event_count_sum:每个时间段内的唯一身份日志事件数量。
  • first_seen:每个时间段内匹配日志事件的首次出现时间戳。
  • last_seen:每个时间段内匹配日志事件的最后一次出现时间戳。
  • value_sum:表示该时间段内所有日志事件的字节数总和。此值只能用于名称中包含 bytes 的指标函数。
  • num_unique_filter_values:Google SecOps 未预先计算但可在规则执行期间计算的指标。如需了解详情,请参阅统计唯一身份指标。

Agg

对指标应用哪种聚合。聚合应用于整个窗口期(例如,过去 30 天内的最高每日值)。允许的值包括:

avg - 每个时间段的平均值。这是统计平均值,不包括零值。

max - 每个时间段的最大值。

min - 每个时间段的最小值。

num_metric_periods - 时间范围内具有非零指标值的周期数。

stddev - 每个周期值的标准差。这是不包含零值的统计标准差。

sum - 整个时间段内每个时间段的值的总和。

例如,以下规则会告诉您在过去 30 天内的任何一天,特定用户 (Alice) 的平均身份验证尝试失败次数:

$user = "alice"
$avg_fail = max(metrics.auth_attempts_fail(
        period:1d, window:30d,
        metric:event_count_sum,
        agg:avg,
        target.user.userid:$user
))

以下规则会告诉您特定用户在过去 30 天内成功进行了多少次身份验证:

$total_success = max(metrics.auth_attempts_success(
        period:1d, window:30d,
        metric:event_count_sum,
        agg:sum,
        target.user.userid:$user
))

以下规则会告知您特定用户在过去 30 天内是否至少成功登录过一次:

$days_success = max(metrics.auth_attempts_success(
        period:1d, window:30d,
        metric:event_count_sum,
        agg:num_metric_periods,
        target.user.userid:$user
))

以下规则会告知您特定用户首次或最后一次成功登录的时间:

$first_seen = max(metrics.auth_attempts_success(
        period:1d, window:30d,
        metric:first_seen,
        agg:min,
        target.user.userid:$user
))
$last_seen = max(metrics.auth_attempts_success(
        period:1d, window:30d,
        metric:last_seen,
        agg:max,
        target.user.userid:$user
))

以下规则会告知您过去 30 天内用户在任何给定日期发送的最大字节数:

$max_daily_bytes = max(metrics.network_bytes_outbound(
        period:1d, window:30d,
        metric:value_sum,
        agg:max,
        target.user.userid:$user
))

过滤

过滤条件允许在聚合之前按预先计算的指标中的值过滤指标(请参阅指标中的值)。过滤条件可以是任何不包含任何事件字段或占位符的有效事件表达式(事件部分中的单行)。此条件中只能包含指标类型变量。

以下规则仅包含 value_sum > 10 AND event_count_sum > 2 的指标:

$max_bytes_per_day = max(metrics.network_bytes_outbound(
    period:1d, window:30d,
    metric:value_sum,
    agg:max,
    principal.asset.ip:$ip
    filter:value_sum > 10 AND event_count_sum > 2
))

过滤器的有效示例

filter:value_sum > 10 AND event_count_sum != 5
filter:event_count_sum = 100 OR event_count_sum > 1000
filter:timestamp.get_day_of_week(first_seen) = 3
无效的过滤条件示例
// No placeholders in filter expressions.
filter:value_sum > $ph

// No event fields in filter expressions.
filter:event_count_sum + $e.field > 10

// No event fields in filter expressions.
filter:timestamp.subtract(first_seen, $e.metadata.timestamp)

UDM 字段

指标按 1、2 或 3 个 UDM 字段进行过滤,具体取决于相应函数。如需了解详情,请参阅函数。

指标函数使用以下类型的 UDM 字段:

  • 维度 -(必需)本文档中列出了不同的组合。您无法联接具有默认值(字符串为 "",int 为 0)的指标。
  • 命名空间 -(可选)您只能对在维度中指定的实体使用命名空间。例如,如果您使用 principal.asset.hostname filter,也可以使用 principal.namespace filter。如果您不添加命名空间过滤条件,则所有命名空间中的数据都会汇总在一起。您可以使用默认值作为命名空间过滤条件。

窗口计算

Google Security Operations 会使用每日或每小时指标窗口计算指标。

每日窗口期

所有每日时间范围(例如 30d)都以相同的方式确定。 Google Security Operations 会使用已生成的最新可用指标数据,这些数据与规则时间范围不重叠。每日指标的计算最多可能需要 6 小时才能完成,并且在世界协调时间 (UTC) 的一天结束之前不会开始。前一天的指标数据将在每天世界协调时间 (UTC) 6:00 或之前提供。

例如,对于在 2023-10-31 4:00 UTC 到 2023-10-31 7:00 UTC 期间运行的规则,2023-10-31 的每日指标可能已经生成,因此指标计算将使用 2023-10-01 到 2023-10-30(含)的事件数据。而对于在 2023-10-31 1:00 UTC 到 2023-10-31 3:00 UTC 期间针对事件数据运行的规则,2023-10-30 的每日指标可能尚未生成,因此指标计算将使用 2023-09-30 到 2023-10-29(含)的数据。

每小时 today 窗口

每小时指标窗口的计算方式与每日指标窗口不同。today 的每小时指标窗口不像每日指标的 30d 窗口那样大小固定。每小时指标时间范围 today 会在每日时间范围结束到规则时间范围开始之间填充尽可能多的数据。

例如,对于在 2023-10-31 4:00:00 UTC 到 2023-10-31 7:00:00 UTC 期间的事件数据上运行的规则,每日指标计算将使用 2023-10-01 到 2023-10-30(含)的数据,而每小时指标窗口将使用 2023-10-31 00:00:00 UTC 到 2023-10-31 4:00:00 UTC 的数据。

统计唯一指标

有一种特殊类型的指标 num_unique_filter_values,它不是由 Google SecOps 预先计算的,而是在规则执行期间计算的。为此,系统会针对预先计算的指标中的现有维度进行汇总。例如,通过对维度 执行唯一 计数聚合,可以从 维度 target.user.userid 和 principal.ip_geo_artifact.location.country_or_region 上的预计算 auth_attempts_total 指标派生出指标 daily total count of distinct countries that a user attempted to authenticate 。

以下示例规则会统计唯一身份指标:

$outcome_variable = max(metrics.auth_attempts_total(
    period: 1d,
    window: 30d,
    // This metric type indicates any filter with a wildcard value should be
    // aggregated over each day to produce a new metric on-the-fly.
    metric: num_unique_filter_values,
    agg: max,
    target.user.userid: $userid,
    // Filter whose value should be counted over each day to produce the
    // num_unique_filter_values metric.
    principal.ip_geo_artifact.location.country_or_region: *
))

函数

本部分包含有关 Google Security Operations 支持的特定指标函数的文档。

提醒事件

metrics.alert_event_name_count 会预先计算 UDM 事件的历史值,这些事件已由 Carbon Black、CrowdStrike Falcon、Microsoft Graph API Alerts 或 Microsoft Sentinel 生成提醒。

可用作过滤条件的 UDM 字段的完整列表

  • principal.asset.asset_id, principal.process.file.full_path, principal.user.email_addresses, security_result.rule_name
  • principal.asset.asset_id, principal.process.file.full_path, principal.user.employee_id, security_result.rule_name
  • principal.asset.asset_id, principal.process.file.full_path, principal.user.product_object_id, security_result.rule_name
  • principal.asset.asset_id, principal.process.file.full_path, principal.user.userid, security_result.rule_name
  • principal.asset.asset_id, principal.process.file.full_path, principal.user.windows_sid, security_result.rule_name
  • principal.asset.asset_id, principal.process.file.full_path, security_result.rule_name
  • principal.asset.asset_id, principal.process.file.sha256, principal.user.email_addresses, security_result.rule_name
  • principal.asset.asset_id, principal.process.file.sha256, principal.user.employee_id, security_result.rule_name
  • principal.asset.asset_id, principal.process.file.sha256, principal.user.product_object_id, security_result.rule_name
  • principal.asset.asset_id, principal.process.file.sha256, principal.user.userid, security_result.rule_name
  • principal.asset.asset_id, principal.process.file.sha256, principal.user.windows_sid, security_result.rule_name
  • principal.asset.asset_id, security_result.rule_name
  • principal.asset.hostname, principal.process.file.full_path, principal.user.email_addresses, security_result.rule_name
  • principal.asset.hostname, principal.process.file.full_path, principal.user.employee_id, security_result.rule_name
  • principal.asset.hostname, principal.process.file.full_path, principal.user.product_object_id, security_result.rule_name
  • principal.asset.hostname, principal.process.file.full_path, principal.user.userid, security_result.rule_name
  • principal.asset.hostname, principal.process.file.full_path, principal.user.windows_sid, security_result.rule_name
  • principal.asset.hostname, principal.process.file.full_path, security_result.rule_name
  • principal.asset.hostname, principal.process.file.sha256, principal.user.email_addresses, security_result.rule_name
  • principal.asset.hostname, principal.process.file.sha256, principal.user.employee_id, security_result.rule_name
  • principal.asset.hostname, principal.process.file.sha256, principal.user.product_object_id, security_result.rule_name
  • principal.asset.hostname, principal.process.file.sha256, principal.user.userid, security_result.rule_name
  • principal.asset.hostname, principal.process.file.sha256, principal.user.windows_sid, security_result.rule_name
  • principal.asset.hostname, security_result.rule_name
  • principal.asset.ip, principal.process.file.full_path, principal.user.email_addresses, security_result.rule_name
  • principal.asset.ip, principal.process.file.full_path, principal.user.employee_id, security_result.rule_name
  • principal.asset.ip, principal.process.file.full_path, principal.user.product_object_id, security_result.rule_name
  • principal.asset.ip, principal.process.file.full_path, principal.user.userid, security_result.rule_name
  • principal.asset.ip, principal.process.file.full_path, principal.user.windows_sid, security_result.rule_name
  • principal.asset.ip, principal.process.file.full_path, security_result.rule_name
  • principal.asset.ip, principal.process.file.sha256, principal.user.email_addresses, security_result.rule_name
  • principal.asset.ip, principal.process.file.sha256, principal.user.employee_id, security_result.rule_name
  • principal.asset.ip, principal.process.file.sha256, principal.user.product_object_id, security_result.rule_name
  • principal.asset.ip, principal.process.file.sha256, principal.user.userid, security_result.rule_name
  • principal.asset.ip, principal.process.file.sha256, principal.user.windows_sid, security_result.rule_name
  • principal.asset.ip, security_result.rule_name
  • principal.asset.mac, principal.process.file.full_path, principal.user.email_addresses, security_result.rule_name
  • principal.asset.mac, principal.process.file.full_path, principal.user.employee_id, security_result.rule_name
  • principal.asset.mac, principal.process.file.full_path, principal.user.product_object_id, security_result.rule_name
  • principal.asset.mac, principal.process.file.full_path, principal.user.userid, security_result.rule_name
  • principal.asset.mac, principal.process.file.full_path, principal.user.windows_sid, security_result.rule_name
  • principal.asset.mac, principal.process.file.full_path, security_result.rule_name
  • principal.asset.mac, principal.process.file.sha256, principal.user.email_addresses, security_result.rule_name
  • principal.asset.mac, principal.process.file.sha256, principal.user.employee_id, security_result.rule_name
  • principal.asset.mac, principal.process.file.sha256, principal.user.product_object_id, security_result.rule_name
  • principal.asset.mac, principal.process.file.sha256, principal.user.userid, security_result.rule_name
  • principal.asset.mac, principal.process.file.sha256, principal.user.windows_sid, security_result.rule_name
  • principal.asset.mac, security_result.rule_name
  • principal.asset.product_object_id, principal.process.file.full_path, principal.user.email_addresses, security_result.rule_name
  • principal.asset.product_object_id, principal.process.file.full_path, principal.user.employee_id, security_result.rule_name
  • principal.asset.product_object_id, principal.process.file.full_path, principal.user.product_object_id, security_result.rule_name
  • principal.asset.product_object_id, principal.process.file.full_path, principal.user.userid, security_result.rule_name
  • principal.asset.product_object_id, principal.process.file.full_path, principal.user.windows_sid, security_result.rule_name
  • principal.asset.product_object_id, principal.process.file.full_path, security_result.rule_name
  • principal.asset.product_object_id, principal.process.file.sha256, principal.user.email_addresses, security_result.rule_name
  • principal.asset.product_object_id, principal.process.file.sha256, principal.user.employee_id, security_result.rule_name
  • principal.asset.product_object_id, principal.process.file.sha256, principal.user.product_object_id, security_result.rule_name
  • principal.asset.product_object_id, principal.process.file.sha256, principal.user.userid, security_result.rule_name
  • principal.asset.product_object_id, principal.process.file.sha256, principal.user.windows_sid, security_result.rule_name
  • principal.asset.product_object_id, security_result.rule_name

身份验证尝试

metrics.auth_attempts_total 会使用 USER_LOGIN event type 预先计算 UDM 事件的历史值。

metrics.auth_attempts_success 还要求事件至少具有一个 ALLOW 的 SecurityResult.Action。

metrics.auth_attempts_fail 则要求所有 SecurityResult.Actions 都不是 ALLOW。

可用作过滤条件的 UDM 字段的完整列表

  • principal.asset.asset_id
  • principal.asset.asset_id,target.asset.asset_id
  • principal.asset.asset_id、target.asset.hostname
  • principal.asset.asset_id、target.asset.ip
  • principal.asset.asset_id、target.asset.mac
  • principal.asset.asset_id、target.asset.product_object_id
  • principal.asset.hostname
  • principal.asset.hostname、target.asset.asset_id
  • principal.asset.hostname、target.asset.hostname
  • principal.asset.hostname、target.asset.ip
  • principal.asset.hostname、target.asset.mac
  • principal.asset.hostname、target.asset.product_object_id
  • principal.asset.ip
  • principal.asset.ip、target.asset.asset_id
  • principal.asset.ip、target.asset.hostname
  • principal.asset.ip、target.asset.ip
  • principal.asset.ip、target.asset.mac
  • principal.asset.ip、target.asset.product_object_id
  • principal.asset.mac
  • principal.asset.mac、target.asset.asset_id
  • principal.asset.mac、target.asset.hostname
  • principal.asset.mac、target.asset.ip
  • principal.asset.mac、target.asset.mac
  • principal.asset.mac、target.asset.product_object_id
  • principal.asset.product_object_id
  • principal.asset.product_object_id、target.asset.asset_id
  • principal.asset.product_object_id、target.asset.hostname
  • principal.asset.product_object_id、target.asset.ip
  • principal.asset.product_object_id、target.asset.mac
  • principal.asset.product_object_id、target.asset.product_object_id
  • principal.user.email_addresses
  • principal.user.email_addresses、target.asset.asset_id
  • principal.user.email_addresses、target.asset.hostname
  • principal.user.email_addresses、target.asset.ip
  • principal.user.email_addresses、target.asset.mac
  • principal.user.email_addresses、target.asset.product_object_id
  • principal.user.employee_id
  • principal.user.employee_id、target.asset.asset_id
  • principal.user.employee_id、target.asset.hostname
  • principal.user.employee_id、target.asset.ip
  • principal.user.employee_id、target.asset.mac
  • principal.user.employee_id、target.asset.product_object_id
  • principal.user.product_object_id
  • principal.user.product_object_id、target.asset.asset_id
  • principal.user.product_object_id、target.asset.hostname
  • principal.user.product_object_id、target.asset.ip
  • principal.user.product_object_id、target.asset.mac
  • principal.user.product_object_id、target.asset.product_object_id
  • principal.user.userid
  • principal.user.userid、target.asset.asset_id
  • principal.user.userid、target.asset.hostname
  • principal.user.userid、target.asset.ip
  • principal.user.userid、target.asset.mac
  • principal.user.userid、target.asset.product_object_id
  • principal.user.windows_sid
  • principal.user.windows_sid、target.asset.asset_id
  • principal.user.windows_sid、target.asset.hostname
  • principal.user.windows_sid、target.asset.ip
  • principal.user.windows_sid、target.asset.mac
  • principal.user.windows_sid、target.asset.product_object_id
  • target.application
  • target.user.email_addresses
  • target.user.email_addresses、network.tls.client.certificate.sha256
  • target.user.email_addresses、principal.ip_geo_artifact.location.country_or_region
  • target.user.email_addresses、principal.ip_geo_artifact.network.organization_name
  • target.user.email_addresses、target.application
  • target.user.employee_id
  • target.user.employee_id、network.tls.client.certificate.sha256
  • target.user.employee_id、principal.ip_geo_artifact.location.country_or_region
  • target.user.employee_id、principal.ip_geo_artifact.network.organization_name
  • target.user.employee_id、target.application
  • target.user.product_object_id
  • target.user.product_object_id、network.tls.client.certificate.sha256
  • target.user.product_object_id、principal.ip_geo_artifact.location.country_or_region
  • target.user.product_object_id、principal.ip_geo_artifact.network.organization_name
  • target.user.product_object_id、target.application
  • target.user.userid
  • target.user.userid、network.tls.client.certificate.sha256
  • target.user.userid、principal.ip_geo_artifact.location.country_or_region
  • target.user.userid、principal.ip_geo_artifact.network.organization_name
  • target.user.userid、target.application
  • target.user.windows_sid
  • target.user.windows_sid、network.tls.client.certificate.sha256
  • target.user.windows_sid、principal.ip_geo_artifact.location.country_or_region
  • target.user.windows_sid、principal.ip_geo_artifact.network.organization_name
  • target.user.windows_sid,target.application

metrics.auth_attempts_total 还有其他 UDM 字段可用作过滤条件

  • target.application,target.asset.asset_id
  • target.application、target.asset.hostname
  • target.application、target.asset.ip
  • target.application、target.asset.mac
  • target.application,target.asset.product_object_id

metrics.auth_attempts_success 还有其他 UDM 字段可用作过滤条件

  • network.http.user_agent
  • principal.asset.asset_id,metadata.event_type
  • principal.asset.hostname、metadata.event_type
  • principal.asset.ip、metadata.event_type
  • principal.asset.mac、metadata.event_type
  • principal.asset.product_object_id,metadata.event_type

DNS 出站字节数

metrics.dns_bytes_outbound 会预先计算 network.sent_bytes 大于 0 且目标端口为 53/udp、53/tcp 或 3000/tcp 的 UDM 事件的历史值。 network.sent_bytes 以 value_sum 形式提供。

可用作过滤条件的 UDM 字段的完整列表

  • principal.asset.asset_id
  • principal.asset.asset_id,target.ip
  • principal.asset.hostname
  • principal.asset.hostname、target.ip
  • principal.asset.ip
  • principal.asset.ip、target.ip
  • principal.asset.mac
  • principal.asset.mac、target.ip
  • principal.asset.product_object_id
  • principal.asset.product_object_id、target.ip
  • principal.user.email_addresses
  • principal.user.email_addresses、target.ip
  • principal.user.employee_id
  • principal.user.employee_id、target.ip
  • principal.user.product_object_id
  • principal.user.product_object_id、target.ip
  • principal.user.userid
  • principal.user.userid、target.ip
  • principal.user.windows_sid
  • principal.user.windows_sid,target.ip
  • target.ip

DNS 查询

metrics.dns_queries_total 会为在 network.dns.id 中具有值的 UDM 事件预计算历史值。

metrics.dns_queries_success 还要求 network。dns.response_code原为0 (NoError)。

metrics.dns_queries_fail 仅考虑具有 network 的事件。dns.response_code 大于 0。

可用作过滤条件的 UDM 字段的完整列表

  • principal.asset.asset_id
  • principal.asset.asset_id,network.dns_domain
  • principal.asset.asset_id、network.dns.questions.type
  • principal.asset.hostname
  • principal.asset.hostname、network.dns_domain
  • principal.asset.hostname、network.dns.questions.type
  • principal.asset.ip
  • principal.asset.ip、network.dns_domain
  • principal.asset.ip、network.dns.questions.type
  • principal.asset.mac
  • principal.asset.mac、network.dns_domain
  • principal.asset.mac、network.dns.questions.type
  • principal.asset.product_object_id
  • principal.asset.product_object_id、network.dns_domain
  • principal.asset.product_object_id、network.dns.questions.type
  • principal.user.email_addresses
  • principal.user.email_addresses、network.dns_domain
  • principal.user.email_addresses、network.dns.questions.type
  • principal.user.employee_id
  • principal.user.employee_id、network.dns_domain
  • principal.user.employee_id、network.dns.questions.type
  • principal.user.product_object_id
  • principal.user.product_object_id、network.dns_domain
  • principal.user.product_object_id、network.dns.questions.type
  • principal.user.userid
  • principal.user.userid、network.dns_domain
  • principal.user.userid、network.dns.questions.type
  • principal.user.windows_sid
  • principal.user.windows_sid、network.dns_domain
  • principal.user.windows_sid,network.dns.questions.type

文件执行

metrics.file_executions_total 会预先计算具有 PROCESS_LAUNCH event type 的 UDM 事件的历史值。

metrics.file_executions_success 进一步要求事件至少有一个 ALLOW 的 SecurityResult.Action。

metrics.file_executions_fail 则要求所有 SecurityResult.Actions 都不是 ALLOW。

可用作过滤条件的 UDM 字段的完整列表

  • metadata.event_type,principal.process.file.sha256
  • metadata.event_type、principal.asset.asset_id、principal.process.file.sha256
  • metadata.event_type、principal.asset.hostname、principal.process.file.sha256
  • metadata.event_type、principal.asset.ip、principal.process.file.sha256
  • metadata.event_type、principal.asset.mac、principal.process.file.sha256
  • metadata.event_type、principal.asset.product_object_id、principal.process.file.sha256
  • metadata.event_type、principal.user.email_addresses、principal.process.file.sha256
  • metadata.event_type、principal.user.employee_id、principal.process.file.sha256
  • metadata.event_type、principal.user.product_object_id、principal.process.file.sha256
  • metadata.event_type、principal.user.userid、principal.process.file.sha256
  • metadata.event_type、principal.user.windows_sid、principal.process.file.sha256

HTTP 查询

metrics.http_queries_total 会为在 network.http.method 中具有值的 UDM 事件预计算历史值。

metrics.http_queries_success 进一步要求 network。http.response_code 小于 400。

metrics.http_queries_fail 仅考虑具有 network 的事件。http.response_code 大于或等于 400。

可用作过滤条件的 UDM 字段的完整列表

  • principal.asset.asset_id
  • principal.asset.asset_id,network.http.user_agent
  • principal.asset.asset_id,target.hostname
  • principal.asset.asset_id、network.http.user_agent、target.hostname
  • principal.asset.hostname
  • principal.asset.hostname,network.http.user_agent
  • principal.asset.hostname,target.hostname
  • principal.asset.hostname、network.http.user_agent、target.hostname
  • principal.asset.ip
  • principal.asset.ip,network.http.user_agent
  • principal.asset.ip,target.hostname
  • principal.asset.ip、network.http.user_agent、target.hostname
  • principal.asset.mac
  • principal.asset.mac,network.http.user_agent
  • principal.asset.mac,target.hostname
  • principal.asset.mac、network.http.user_agent、target.hostname
  • principal.asset.product_object_id
  • principal.asset.product_object_id,network.http.user_agent
  • principal.asset.product_object_id,target.hostname
  • principal.asset.product_object_id、network.http.user_agent、target.hostname
  • principal.user.email_addresses
  • principal.user.email_addresses,network.http.user_agent
  • principal.user.email_addresses,target.hostname
  • principal.user.email_addresses、network.http.user_agent、target.hostname
  • principal.user.employee_id
  • principal.user.employee_id,network.http.user_agent
  • principal.user.employee_id,target.hostname
  • principal.user.employee_id、network.http.user_agent、target.hostname
  • principal.user.product_object_id
  • principal.user.product_object_id,network.http.user_agent
  • principal.user.product_object_id,target.hostname
  • principal.user.product_object_id、network.http.user_agent、target.hostname
  • principal.user.userid
  • principal.user.userid,network.http.user_agent
  • principal.user.userid,target.hostname
  • principal.user.userid、network.http.user_agent、target.hostname
  • principal.user.windows_sid
  • principal.user.windows_sid,network.http.user_agent
  • principal.user.windows_sid,target.hostname
  • principal.user.windows_sid、network.http.user_agent、target.hostname
  • target.hostname

网络字节数

metrics.network_bytes_inbound 会为 network.received_bytes 具有非零值的 UDM 事件预先计算历史值,并将该字段作为 value_sum 提供。

metrics.network_bytes_outbound 要求 network.sent_bytes 具有非零值,并使该字段可用作 value_sum。

metrics.network_bytes_total 会考虑 network.received_bytes 或 network.sent_bytes(或两者)的值不为零的事件,并将这两个字段的总和作为 value_sum 提供。

可用作过滤条件的 UDM 字段的完整列表

  • principal.asset.asset_id
  • principal.asset.asset_id,principal.ip_geo_artifact.location.country_or_region
  • principal.asset.asset_id、security_result.category
  • principal.asset.asset_id、target.ip_geo_artifact.network.organization_name
  • principal.asset.hostname
  • principal.asset.hostname、principal.ip_geo_artifact.location.country_or_region
  • principal.asset.hostname、security_result.category
  • principal.asset.hostname、target.ip_geo_artifact.network.organization_name
  • principal.asset.ip
  • principal.asset.ip、principal.ip_geo_artifact.location.country_or_region
  • principal.asset.ip、security_result.category
  • principal.asset.ip、target.ip_geo_artifact.network.organization_name
  • principal.asset.mac
  • principal.asset.mac、principal.ip_geo_artifact.location.country_or_region
  • principal.asset.mac、security_result.category
  • principal.asset.mac、target.ip_geo_artifact.network.organization_name
  • principal.asset.product_object_id
  • principal.asset.product_object_id、principal.ip_geo_artifact.location.country_or_region
  • principal.asset.product_object_id、security_result.category
  • principal.asset.product_object_id、target.ip_geo_artifact.network.organization_name
  • principal.user.email_addresses
  • principal.user.email_addresses、principal.ip_geo_artifact.location.country_or_region
  • principal.user.email_addresses、security_result.category
  • principal.user.email_addresses、target.ip_geo_artifact.network.organization_name
  • principal.user.employee_id
  • principal.user.employee_id、principal.ip_geo_artifact.location.country_or_region
  • principal.user.employee_id、security_result.category
  • principal.user.employee_id、target.ip_geo_artifact.network.organization_name
  • principal.user.product_object_id
  • principal.user.product_object_id、principal.ip_geo_artifact.location.country_or_region
  • principal.user.product_object_id、security_result.category
  • principal.user.product_object_id、target.ip_geo_artifact.network.organization_name
  • principal.user.userid
  • principal.user.userid、principal.ip_geo_artifact.location.country_or_region
  • principal.user.userid、security_result.category
  • principal.user.userid、target.ip_geo_artifact.network.organization_name
  • principal.user.windows_sid
  • principal.user.windows_sid、principal.ip_geo_artifact.location.country_or_region
  • principal.user.windows_sid、security_result.category
  • principal.user.windows_sid,target.ip_geo_artifact.network.organization_name

资源创建

metrics.resource_creation_total 会预先计算 RESOURCE_CREATION event type 或 USER_RESOURCE_CREATION event type 的 UDM 事件的历史值。

如需查看等效事件类型的列表,请参阅元数据事件类型

metrics.resource_creation_success 还要求事件至少有一个 ALLOW 的 SecurityResult.Action。

可用作过滤条件的 UDM 字段的完整列表

  • principal.user.email_addresses、metadata.vendor_name、metadata.product_name
  • principal.user.employee_id、metadata.vendor_name、metadata.product_name
  • principal.user.product_object_id、metadata.vendor_name、metadata.product_name
  • principal.user.userid、metadata.vendor_name、metadata.product_name
  • principal.user.windows_sid、metadata.vendor_name、metadata.product_name
  • principal.user.email_addresses、principal.ip、metadata.vendor_name、metadata.product_name
  • principal.user.employee_id、principal.ip、metadata.vendor_name、metadata.product_name
  • principal.user.product_object_id、principal.ip、metadata.vendor_name、metadata.product_name
  • principal.user.userid、principal.ip、metadata.vendor_name、metadata.product_name
  • principal.user.windows_sid、principal.ip、metadata.vendor_name、metadata.product_name
  • principal.user.email_addresses、target.application、metadata.vendor_name、metadata.product_name
  • principal.user.employee_id、target.application、metadata.vendor_name、metadata.product_name
  • principal.user.product_object_id、target.application、metadata.vendor_name、metadata.product_name
  • principal.user.userid、target.application、metadata.vendor_name、metadata.product_name
  • principal.user.windows_sid、target.application、metadata.vendor_name、metadata.product_name
  • principal.user.email_addresses、target.application、target.location.name、metadata.vendor_name、metadata.product_name
  • principal.user.employee_id、target.application、target.location.name、metadata.vendor_name、metadata.product_name
  • principal.user.product_object_id、target.application、target.location.name、metadata.vendor_name、metadata.product_name
  • principal.user.userid、target.application、target.location.name、metadata.vendor_name、metadata.product_name
  • principal.user.windows_sid、target.application、target.location.name、metadata.vendor_name、metadata.product_name
  • principal.user.email_addresses、target.resource.name、metadata.vendor_name、metadata.product_name
  • principal.user.employee_id、target.resource.name、metadata.vendor_name、metadata.product_name
  • principal.user.product_object_id、target.resource.name、metadata.vendor_name、metadata.product_name
  • principal.user.userid、target.resource.name、metadata.vendor_name、metadata.product_name
  • principal.user.windows_sid、target.resource.name、metadata.vendor_name、metadata.product_name
  • principal.user.email_addresses、target.resource.name、target.resource_type、metadata.vendor_name、metadata.product_name
  • principal.user.employee_id、target.resource.name、target.resource_type、metadata.vendor_name、metadata.product_name
  • principal.user.product_object_id、target.resource.name、target.resource_type、metadata.vendor_name、metadata.product_name
  • principal.user.userid、target.resource.name、target.resource_type、metadata.vendor_name、metadata.product_name
  • principal.user.windows_sid、target.resource.name、target.resource_type、metadata.vendor_name、metadata.product_name
  • target.user.email_addresses、metadata.vendor_name、metadata.product_name
  • target.user.employee_id、metadata.vendor_name、metadata.product_name
  • target.user.product_object_id、metadata.vendor_name、metadata.product_name
  • target.user.userid、metadata.vendor_name、metadata.product_name
  • target.user.windows_sid、metadata.vendor_name、metadata.product_name

资源删除

metrics.resource_deletion_success 会预先计算具有 RESOURCE_DELETION event type 的 UDM 事件的历史值,并进一步要求该事件至少有一个 ALLOW 的 SecurityResult.Actions。

可用作过滤条件的 UDM 字段的完整列表

  • principal.user.email_addresses、metadata.vendor_name、metadata.product_name
  • principal.user.employee_id、metadata.vendor_name、metadata.product_name
  • principal.user.product_object_id、metadata.vendor_name、metadata.product_name
  • principal.user.userid、metadata.vendor_name、metadata.product_name
  • principal.user.windows_sid、metadata.vendor_name、metadata.product_name
  • principal.user.email_addresses、principal.ip、metadata.vendor_name、metadata.product_name
  • principal.user.employee_id、principal.ip、metadata.vendor_name、metadata.product_name
  • principal.user.product_object_id、principal.ip、metadata.vendor_name、metadata.product_name
  • principal.user.userid、principal.ip、metadata.vendor_name、metadata.product_name
  • principal.user.windows_sid、principal.ip、metadata.vendor_name、metadata.product_name
  • principal.user.email_addresses、target.application、metadata.vendor_name、metadata.product_name
  • principal.user.employee_id、target.application、metadata.vendor_name、metadata.product_name
  • principal.user.product_object_id、target.application、metadata.vendor_name、metadata.product_name
  • principal.user.userid、target.application、metadata.vendor_name、metadata.product_name
  • principal.user.windows_sid、target.application、metadata.vendor_name、metadata.product_name
  • principal.user.email_addresses、target.application、target.location.name、metadata.vendor_name、metadata.product_name
  • principal.user.employee_id、target.application、target.location.name、metadata.vendor_name、metadata.product_name
  • principal.user.product_object_id、target.application、target.location.name、metadata.vendor_name、metadata.product_name
  • principal.user.userid、target.application、target.location.name、metadata.vendor_name、metadata.product_name
  • principal.user.windows_sid、target.application、target.location.name、metadata.vendor_name、metadata.product_name
  • principal.user.email_addresses、target.resource.name、metadata.vendor_name、metadata.product_name
  • principal.user.employee_id、target.resource.name、metadata.vendor_name、metadata.product_name
  • principal.user.product_object_id、target.resource.name、metadata.vendor_name、metadata.product_name
  • principal.user.userid、target.resource.name、metadata.vendor_name、metadata.product_name
  • principal.user.windows_sid、target.resource.name、metadata.vendor_name、metadata.product_name
  • principal.user.email_addresses、target.resource.name、target.resource_type、metadata.vendor_name、metadata.product_name
  • principal.user.employee_id、target.resource.name、target.resource_type、metadata.vendor_name、metadata.product_name
  • principal.user.product_object_id、target.resource.name、target.resource_type、metadata.vendor_name、metadata.product_name
  • principal.user.userid、target.resource.name、target.resource_type、metadata.vendor_name、metadata.product_name
  • principal.user.windows_sid、target.resource.name、target.resource_type、metadata.vendor_name、metadata.product_name
  • target.user.email_addresses、metadata.vendor_name、metadata.product_name
  • target.user.employee_id、metadata.vendor_name、metadata.product_name
  • target.user.product_object_id、metadata.vendor_name、metadata.product_name
  • target.user.userid、metadata.vendor_name、metadata.product_name
  • target.user.windows_sid、metadata.vendor_name、metadata.product_name

资源读取

metrics.resource_read_success 会预先计算具有 RESOURCE_READ event type 的 UDM 事件的历史值,并进一步要求该事件至少有一个 ALLOW 的 SecurityResult.Action。

metrics.resource_read_fail 则要求所有 SecurityResult.Actions 都不是 ALLOW。

可用作过滤条件的 UDM 字段的完整列表

  • principal.user.email_addresses、metadata.vendor_name、metadata.product_name
  • principal.user.employee_id、metadata.vendor_name、metadata.product_name
  • principal.user.product_object_id、metadata.vendor_name、metadata.product_name
  • principal.user.userid、metadata.vendor_name、metadata.product_name
  • principal.user.windows_sid、metadata.vendor_name、metadata.product_name
  • principal.user.email_addresses、principal.ip、metadata.vendor_name、metadata.product_name
  • principal.user.employee_id、principal.ip、metadata.vendor_name、metadata.product_name
  • principal.user.product_object_id、principal.ip、metadata.vendor_name、metadata.product_name
  • principal.user.userid、principal.ip、metadata.vendor_name、metadata.product_name
  • principal.user.windows_sid、principal.ip、metadata.vendor_name、metadata.product_name
  • principal.user.email_addresses、target.application、metadata.vendor_name、metadata.product_name
  • principal.user.employee_id、target.application、metadata.vendor_name、metadata.product_name
  • principal.user.product_object_id、target.application、metadata.vendor_name、metadata.product_name
  • principal.user.userid、target.application、metadata.vendor_name、metadata.product_name
  • principal.user.windows_sid、target.application、metadata.vendor_name、metadata.product_name
  • principal.user.email_addresses、target.application、target.location.name、metadata.vendor_name、metadata.product_name
  • principal.user.employee_id、target.application、target.location.name、metadata.vendor_name、metadata.product_name
  • principal.user.product_object_id、target.application、target.location.name、metadata.vendor_name、metadata.product_name
  • principal.user.userid、target.application、target.location.name、metadata.vendor_name、metadata.product_name
  • principal.user.windows_sid、target.application、target.location.name、metadata.vendor_name、metadata.product_name
  • principal.user.email_addresses、target.resource.name、metadata.vendor_name、metadata.product_name
  • principal.user.employee_id、target.resource.name、metadata.vendor_name、metadata.product_name
  • principal.user.product_object_id、target.resource.name、metadata.vendor_name、metadata.product_name
  • principal.user.userid、target.resource.name、metadata.vendor_name、metadata.product_name
  • principal.user.windows_sid、target.resource.name、metadata.vendor_name、metadata.product_name
  • principal.user.email_addresses、target.resource.name、target.resource_type、metadata.vendor_name、metadata.product_name
  • principal.user.employee_id、target.resource.name、target.resource_type、metadata.vendor_name、metadata.product_name
  • principal.user.product_object_id、target.resource.name、target.resource_type、metadata.vendor_name、metadata.product_name
  • principal.user.userid、target.resource.name、target.resource_type、metadata.vendor_name、metadata.product_name
  • principal.user.windows_sid、target.resource.name、target.resource_type、metadata.vendor_name、metadata.product_name
  • target.user.email_addresses、metadata.vendor_name、metadata.product_name
  • target.user.employee_id、metadata.vendor_name、metadata.product_name
  • target.user.product_object_id、metadata.vendor_name、metadata.product_name
  • target.user.userid、metadata.vendor_name、metadata.product_name
  • target.user.windows_sid、metadata.vendor_name、metadata.product_name

指标限制

使用指标创建 YARA-L 规则时,请注意以下限制:

  • 您无法联接具有默认值(字符串为 "",整数为 0)的指标。
  • 默认值:
    • 如果没有与事件对应的指标数据,则指标函数返回的值为 0。
    • 如果检测中存在没有指标数据的事件,则使用 min 对函数进行汇总可能会返回 0。
    • 如需检查某个事件是否有数据,您可以对该事件使用指标 num_metric_periods 聚合,并应用相同的过滤条件。
  • 指标函数只能在 outcome 部分中使用。
  • 由于指标函数仅在结果部分中使用,因此它们必须像具有匹配部分的规则中的任何其他值一样进行汇总。

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