安全湖查询 AWS 源版本 2 (OCSF1.1.0) - Amazon Security Lake

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

安全湖查询 AWS 源版本 2 (OCSF1.1.0)

你可以查询 Security Lake 存储的数据 AWS Lake Formation 数据库和表。您也可以在 Security Lake 控制台中创建第三方订阅者API,或者 AWS CLI。 第三方订阅者还可以从您指定的来源查询 Lake Formation 数据。

Lake Formation 数据湖管理员必须向查询数据的IAM身份授予相关数据库和表的SELECT权限。订阅用户也必须是在 Security Lake 中创建的,然后才能查询数据。有关如何创建具有查询权限的订阅用户的更多信息,请参阅管理 Security Lake 订阅用户的查询访问权限

以下部分提供了有关从 Security Lake 中查询数据的指导,并包括一些原生支持的查询示例 AWS 来源。这些查询旨在检索特定数据中的数据 AWS 区域。 这些示例使用 us-east-1(美国东部(弗吉尼亚北部))。此外,示例查询使用 LIMIT 25 参数,最多返回 25 条记录。您可以省略该参数或根据自己的偏好进行调整。有关更多示例,请参阅 Amazon Security Lak GitHub e OCSF 查询目录

日志源表

查询 Security Lake 数据时,您必须将数据所在的 Lake Formation 表的名称包含在内。

SELECT * FROM "amazon_security_lake_glue_db_DB_Region"."amazon_security_lake_table_DB_Region_SECURITY_LAKE_TABLE" WHERE time_dt BETWEEN CURRENT_TIMESTAMP - INTERVAL '7' DAY AND CURRENT_TIMESTAMP LIMIT 25

日志源表的常见值包括以下内容:

  • cloud_trail_mgmt_2_0 – AWS CloudTrail 管理事件

  • lambda_execution_2_0— Lambda CloudTrail 的数据事件

  • s3_data_2_0— S3 CloudTrail 的数据事件

  • route53_2_0 – Amazon Route 53 Resolver 查询日志

  • sh_findings_2_0 – AWS Security Hub findings

  • vpc_flow_2_0— 亚马逊 Virtual Private Cloud(亚马逊VPC)流日志

  • eks_audit_2_0— 亚马逊 Elastic Kubernetes Service(亚马逊)审计日志 EKS

  • waf_2_0 – AWS WAF v2 日志

示例:表 sh_findings_2_0 中来自 us-east-1 区域的所有 Security Hub 调查发现

SELECT * FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_sh_findings_2_0" WHERE time_dt BETWEEN CURRENT_TIMESTAMP - INTERVAL '7' DAY AND CURRENT_TIMESTAMP LIMIT 25

数据库区域

查询 Security Lake 数据时,您必须将要从中查询数据的数据库区域名称包含在内。有关当前提供 Security Lake 的数据库区域的完整列表,请参阅 Amazon Security Lake 端点

示例:列出来自来源 IP 的亚马逊 Virtual Private Cloud 活动

以下示例列出了来自源 IP 的所有亚马逊VPC活动 192.0.2.1 那是在之后录制的 20230301 (2023 年 3 月 1 日),在表格中 vpc_flow_2_0 来自 us-west-2 DB_Region.

SELECT * FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_vpc_flow_2_0" WHERE time_dt > TIMESTAMP '2023-03-01' AND src_endpoint.ip = '192.0.2.1' ORDER BY time_dt desc LIMIT 25

分区日期

通过对数据进行分区,您可以限制每次查询所扫描的数据量,从而提高性能并降低成本。与 Security Lake 1.0 相比,Security Lake 2.0 中的分区工作 Security Lake 现在通过time_dtregion、和accountid实现分区。而 Security Lake 1.0 通过eventDayregion、和accountid参数实现了分区。

查询time_dt将自动生成来自 S3 的日期分区,并且可以像 Athena 中任何基于时间的字段一样进行查询。

以下是使用 time_dt分区查询 2023 年 3 月 1 日之后的日志的查询示例:

SELECT * FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_vpc_flow_2_0" WHERE time_dt > TIMESTAMP '2023-03-01' AND src_endpoint.ip = '192.0.2.1' ORDER BY time desc LIMIT 25

time_dt 的常见值包括以下内容:

过去 1 年内发生的事件

WHERE time_dt > CURRENT_TIMESTAMP - INTERVAL '1' YEAR

过去 1 个月内发生的事件

WHERE time_dt > CURRENT_TIMESTAMP - INTERVAL '1' MONTH

过去 30 天内发生的事件

WHERE time_dt > CURRENT_TIMESTAMP - INTERVAL '30' DAY

过去 12 个小时内发生的事件

WHERE time_dt > CURRENT_TIMESTAMP - INTERVAL '12' HOUR

过去 5 分钟内发生的事件

WHERE time_dt > CURRENT_TIMESTAMP - INTERVAL '5' MINUTE

7-14 天前发生的事件

WHERE time_dt BETWEEN CURRENT_TIMESTAMP - INTERVAL '14' DAY AND CURRENT_TIMESTAMP - INTERVAL '7' DAY

在特定日期当天或之后发生的事件

WHERE time_dt >= TIMESTAMP '2023-03-01'

示例:表中列出了 2023 年 3 月 1 日当天或之后来自源 IP 192.0.2.1 的所有 CloudTrail 活动 cloud_trail_mgmt_1_0

SELECT * FROM amazon_security_lake_glue_db_us_east_1.amazon_security_lake_table_us_east_1_cloud_trail_mgmt_1_0 WHERE eventDay >= '20230301' AND src_endpoint.ip = '192.0.2.1' ORDER BY time desc LIMIT 25

示例:表中列出了过去 30 天内来自源 IP 192.0.2.1 的所有 CloudTrail 活动 cloud_trail_mgmt_1_0

SELECT * FROM amazon_security_lake_glue_db_us_east_1.amazon_security_lake_table_us_east_1_cloud_trail_mgmt_1_0 WHERE eventDay > cast(date_format(current_timestamp - INTERVAL '30' day, '%Y%m%d%H') as varchar) AND src_endpoint.ip = '192.0.2.1' ORDER BY time desc LIMIT 25

查询安全湖观测数据

Observables 是 Security Lake 2.0 现已推出的一项新功能。observable 对象是一个枢轴元素,其中包含在事件中许多地方发现的相关信息。通过查询可观察数据,用户可以从其数据集中获得高级安全见解。

通过查询 observables 中的特定元素,您可以将数据集限制为诸如特定用户名、资源UIDsIPs、哈希值和其他IOC类型信息之类的内容

这是一个使用 observables 数组查询包含 IP 值 “172.01.02.03” 的 VPC Flow 和 Route53 表中的日志的查询示例

WITH a AS (SELECT time_dt, observable.name, observable.value FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_vpc_flow_2_0", UNNEST(observables) AS t(observable) WHERE time_dt BETWEEN CURRENT_TIMESTAMP - INTERVAL '7' DAY AND CURRENT_TIMESTAMP AND observable.value='172.01.02.03' AND observable.name='src_endpoint.ip'), b as (SELECT time_dt, observable.name, observable.value FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_route53_2_0", UNNEST(observables) AS t(observable) WHERE time_dt BETWEEN CURRENT_TIMESTAMP - INTERVAL '7' DAY AND CURRENT_TIMESTAMP AND observable.value='172.01.02.03' AND observable.name='src_endpoint.ip') SELECT * FROM a LEFT JOIN b ON a.value=b.value and a.name=b.name LIMIT 25

查询 CloudTrail 数据

AWS CloudTrail 跟踪用户活动和API使用情况 AWS 服务。 订阅者可以查询 CloudTrail 数据以了解以下类型的信息:

以下是一些 CloudTrail 数据查询示例:

未经授权的企图 AWS 服务 在过去 7 天内

SELECT time_dt, api.service.name, api.operation, api.response.error, api.response.message, api.response.data, cloud.region, actor.user.uid, src_endpoint.ip, http_request.user_agent FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_cloud_trail_mgmt_2_0" WHERE time_dt BETWEEN CURRENT_TIMESTAMP - INTERVAL '7' DAY AND CURRENT_TIMESTAMP AND api.response.error in ( 'Client.UnauthorizedOperation', 'Client.InvalidPermission.NotFound', 'Client.OperationNotPermitted', 'AccessDenied') ORDER BY time desc LIMIT 25

过去 7 天192.0.2.1内来自源 IP 的所有 CloudTrail 活动清单

SELECT api.request.uid, time_dt, api.service.name, api.operation, cloud.region, actor.user.uid, src_endpoint.ip, http_request.user_agent FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_cloud_trail_mgmt_2_0" WHERE time_dt BETWEEN CURRENT_TIMESTAMP - INTERVAL '7' DAY AND CURRENT_TIMESTAMP AND src_endpoint.ip = '192.0.2.1.' ORDER BY time desc LIMIT 25

过去 7 天内的所有IAM活动清单

SELECT * FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_cloud_trail_mgmt_2_0" WHERE time_dt BETWEEN CURRENT_TIMESTAMP - INTERVAL '7' DAY AND CURRENT_TIMESTAMP AND api.service.name = 'iam.amazonaws.com' ORDER BY time desc LIMIT 25

过去 7 天内使用过凭证 AIDACKCEVSQ6C2EXAMPLE 的实例

SELECT actor.user.uid, actor.user.uid_alt, actor.user.account.uid, cloud.region FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_cloud_trail_mgmt_2_0" WHERE time_dt BETWEEN CURRENT_TIMESTAMP - INTERVAL '7' DAY AND CURRENT_TIMESTAMP AND actor.user.credential_uid = 'AIDACKCEVSQ6C2EXAMPLE' LIMIT 25

过去 7 天内失败的 CloudTrail 记录列表

SELECT actor.user.uid, actor.user.uid_alt, actor.user.account.uid, cloud.region FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_cloud_trail_mgmt_2_0" WHERE status='failed' and time_dt BETWEEN CURRENT_TIMESTAMP - INTERVAL '7' DAY AND CURRENT_TIMESTAMP ORDER BY time DESC LIMIT 25

查询 Route 53 解析器查询日志

Amazon Route 53 解析器DNS查询日志会跟踪您的亚马逊VPC内部资源进行的查询。订阅用户可以查询 Route 53 Resolver 查询日志,以了解以下类型的信息:

以下是 Route 53 reesolver 查询日志的一些示例查询:

最近 7 天 CloudTrail 内的DNS查询列表

SELECT time_dt, src_endpoint.instance_uid, src_endpoint.ip, src_endpoint.port, query.hostname, rcode FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_route53_2_0" WHERE time_dt BETWEEN CURRENT_TIMESTAMP - INTERVAL '7' DAY AND CURRENT_TIMESTAMP ORDER BY time DESC LIMIT 25

最近 7 天s3.amazonaws.com内匹配的DNS查询列表

SELECT time_dt, src_endpoint.instance_uid, src_endpoint.ip, src_endpoint.port, query.hostname, rcode, answers FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_route53_2_0" WHERE query.hostname LIKE 's3.amazonaws.com.' and time_dt BETWEEN CURRENT_TIMESTAMP - INTERVAL '7' DAY AND CURRENT_TIMESTAMP ORDER BY time DESC LIMIT 25

过去 7 天内未解决的DNS查询列表

SELECT time_dt, src_endpoint.instance_uid, src_endpoint.ip, src_endpoint.port, query.hostname, rcode, answers FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_route53_2_0" WHERE cardinality(answers) = 0 and time_dt BETWEEN CURRENT_TIMESTAMP - INTERVAL '7' DAY AND CURRENT_TIMESTAMP LIMIT 25

最近 7 天192.0.2.1内@@ 已解决的DNS查询列表

SELECT time_dt, src_endpoint.instance_uid, src_endpoint.ip, src_endpoint.port, query.hostname, rcode, answer.rdata FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_route53_2_0", UNNEST(answers) as st(answer) WHERE answer.rdata='192.0.2.1' AND time_dt BETWEEN CURRENT_TIMESTAMP - INTERVAL '7' DAY AND CURRENT_TIMESTAMP LIMIT 25

查询 Security Hub 的调查结果

Security Hub 可让您全面了解自己的安全状态 AWS 并帮助您根据安全行业标准和最佳实践检查您的环境。Security Hub 会为安全检查生成调查发现,并接收来自第三方服务的调查发现。

以下是 Security Hub 发现的一些查询示例:

过去 7 天内严重性等级大于或等于 MEDIUM 的新调查发现

SELECT time_dt, finding_info, severity_id, status FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_sh_findings_2_0" WHERE time_dt BETWEEN CURRENT_TIMESTAMP - INTERVAL '7' DAY AND CURRENT_TIMESTAMP AND severity_id >= 3 AND status = 'New' ORDER BY time DESC LIMIT 25

过去 7 天内的重复调查发现

SELECT finding_info.uid, MAX(time_dt) AS time, ARBITRARY(region) AS region, ARBITRARY(accountid) AS accountid, ARBITRARY(finding_info) AS finding, ARBITRARY(vulnerabilities) AS vulnerabilities FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_sh_findings_2_0" WHERE time_dt BETWEEN CURRENT_TIMESTAMP - INTERVAL '7' DAY AND CURRENT_TIMESTAMP GROUP BY finding_info.uid LIMIT 25

过去 7 天内的所有非信息性调查发现

SELECT time_dt, finding_info.title, finding_info, severity FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_sh_findings_2_0" WHERE severity != 'Informational' and time_dt BETWEEN CURRENT_TIMESTAMP - INTERVAL '7' DAY AND CURRENT_TIMESTAMP LIMIT 25

资源为 Amazon S3 存储桶的调查发现(无时间限制)

SELECT * FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_sh_findings_2_0" WHERE any_match(resources, element -> element.type = 'amzn-s3-demo-bucket') LIMIT 25

通用漏洞评分系统 (CVSS) 分数大于1(无时间限制)的调查结果

SELECT DISTINCT finding_info.uid time_dt, metadata, finding_info, vulnerabilities, resource FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_sh_findings_2_0", UNNEST(vulnerabilities) AS t(vulnerability), UNNEST(vulnerability.cve.cvss) AS t(cvs) WHERE cvs.base_score > 1.0 AND vulnerabilities is NOT NULL LIMIT 25

与常见漏洞和风险暴露相匹配的调查结果 (CVE)CVE-0000-0000(无时间限制)

SELECT * FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_sh_findings_2_0" WHERE any_match(vulnerabilities, element -> element.cve.uid = 'CVE-0000-0000') LIMIT 25

过去 7 天内从 Security Hub 发送调查发现的产品数量

SELECT metadata.product.name, count(*) FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_sh_findings_2_0" WHERE time_dt BETWEEN CURRENT_TIMESTAMP - INTERVAL '7' DAY AND CURRENT_TIMESTAMP GROUP BY metadata.product.name ORDER BY metadata.product.name DESC LIMIT 25

过去 7 天内调查发现中的资源类型数量

SELECT count(*) AS "Total", resource.type FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_sh_findings_2_0" WHERE time_dt BETWEEN CURRENT_TIMESTAMP - INTERVAL '7' DAY AND CURRENT_TIMESTAMP GROUP BY resource.type ORDER BY count(*) DESC LIMIT 25

过去 7 天内调查发现中的易受攻击软件包

SELECT vulnerabilities FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_sh_findings_2_0" WHERE time_dt BETWEEN CURRENT_TIMESTAMP - INTERVAL '7' DAY AND CURRENT_TIMESTAMP AND vulnerabilities is NOT NULL LIMIT 25

过去 7 天内发生更改的调查发现

SELECT status, finding_info.title, finding_info.created_time_dt, finding_info, finding_info.uid, finding_info.first_seen_time_dt, finding_info.last_seen_time_dt, finding_info.modified_time_dt FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_sh_findings_2_0" WHERE time_dt BETWEEN CURRENT_TIMESTAMP - INTERVAL '7' DAY AND CURRENT_TIMESTAMP LIMIT 25

查询 Amazon VPC 流日志

Amazon Virtual Private Cloud(亚马逊VPC)提供了有关进出您的网络接口的 IP 流量的详细信息VPC。

以下是 Amazon VPC Flow Logs 的一些查询示例:

具体流量 AWS 区域 在过去 7 天内

SELECT * FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_vpc_flow_2_0" WHERE time_dt BETWEEN CURRENT_TIMESTAMP - INTERVAL '7' DAY AND CURRENT_TIMESTAMP AND region in ('us-east-1','us-east-2','us-west-2') LIMIT 25

过去 7 天内来自源 IP 192.0.2.1 和源端口 22 的活动的列表

SELECT * FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_vpc_flow_2_0" WHERE time_dt BETWEEN CURRENT_TIMESTAMP - INTERVAL '7' DAY AND CURRENT_TIMESTAMP AND src_endpoint.ip = '192.0.2.1' AND src_endpoint.port = 22 LIMIT 25

过去 7 天内不同目标 IP 地址的数量

SELECT COUNT(DISTINCT dst_endpoint.ip) AS "Total" FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_vpc_flow_2_0" WHERE time_dt BETWEEN CURRENT_TIMESTAMP - INTERVAL '7' DAY AND CURRENT_TIMESTAMP LIMIT 25

过去 7 天内源自 198.51.100.0/24 的流量

SELECT * FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_vpc_flow_2_0" WHERE time_dt BETWEEN CURRENT_TIMESTAMP - INTERVAL '7' DAY AND CURRENT_TIMESTAMP AND split_part(src_endpoint.ip,'.', 1)='198'AND split_part(src_endpoint.ip,'.', 2)='51' LIMIT 25

最近 7 天的所有HTTPS流量

SELECT dst_endpoint.ip as dst, src_endpoint.ip as src, traffic.packets FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_vpc_flow_2_0" WHERE time_dt BETWEEN CURRENT_TIMESTAMP - INTERVAL '7' DAY AND CURRENT_TIMESTAMP AND dst_endpoint.port = 443 GROUP BY dst_endpoint.ip, traffic.packets, src_endpoint.ip ORDER BY traffic.packets DESC LIMIT 25

按过去 7 天内发送到端口 443 的连接的数据包数量排序

SELECT traffic.packets, dst_endpoint.ip FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_vpc_flow_2_0" WHERE time_dt BETWEEN CURRENT_TIMESTAMP - INTERVAL '7' DAY AND CURRENT_TIMESTAMP AND dst_endpoint.port = 443 GROUP BY traffic.packets, dst_endpoint.ip ORDER BY traffic.packets DESC LIMIT 25

过去 7 天内 IP 192.0.2.1192.0.2.2 之间的所有流量

SELECT start_time_dt, end_time_dt, src_endpoint.interface_uid, connection_info.direction, src_endpoint.ip, dst_endpoint.ip, src_endpoint.port, dst_endpoint.port, traffic.packets, traffic.bytes FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_vpc_flow_2_0" WHERE time_dt BETWEEN CURRENT_TIMESTAMP - INTERVAL '7' DAY AND CURRENT_TIMESTAMP AND( src_endpoint.ip = '192.0.2.1' AND dst_endpoint.ip = '192.0.2.2') OR ( src_endpoint.ip = '192.0.2.2' AND dst_endpoint.ip = '192.0.2.1') ORDER BY start_time_dt ASC LIMIT 25

过去 7 天内的所有入站流量

SELECT * FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_vpc_flow_2_0" WHERE time_dt BETWEEN CURRENT_TIMESTAMP - INTERVAL '7' DAY AND CURRENT_TIMESTAMP AND connection_info.direction = 'Inbound' LIMIT 25

过去 7 天的所有出站流量

SELECT * FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_vpc_flow_2_0" WHERE time_dt BETWEEN CURRENT_TIMESTAMP - INTERVAL '7' DAY AND CURRENT_TIMESTAMP AND connection_info.direction = 'Outbound' LIMIT 25

过去 7 天内所有被拒绝的流量

SELECT * FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_vpc_flow_2_0" WHERE time_dt BETWEEN CURRENT_TIMESTAMP - INTERVAL '7' DAY AND CURRENT_TIMESTAMP AND action = 'Denied' LIMIT 25

查询 Amazon EKS 审计日志

Amazon EKS 日志跟踪控制平面活动可直接从亚马逊EKS控制平面向您的账户提供审计和诊断 CloudWatch 日志。这些日志可让您轻松地保护和运行您的集群。订阅者可以查询EKS日志以了解以下类型的信息。

以下是一些针对 Amazon EKS 审计日志的查询示例:

过去 7 天URL内向特定用户发出的请求

SELECT time_dt, actor.user.name, http_request.url.path, activity_name FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_eks_audit_2_0" WHERE time_dt BETWEEN CURRENT_TIMESTAMP - INTERVAL '7' DAY AND CURRENT_TIMESTAMP AND activity_name = 'get' and http_request.url.path = '/apis/coordination.k8s.io/v1/' LIMIT 25

更新过去 7 天来自 “10.0.97.167” 的请求

SELECT activity_name, time_dt, api.request, http_request.url.path, src_endpoint.ip, resources FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_eks_audit_2_0" WHERE time_dt BETWEEN CURRENT_TIMESTAMP - INTERVAL '7' DAY AND CURRENT_TIMESTAMP AND src_endpoint.ip = '10.0.97.167' AND activity_name = 'Update' LIMIT 25

过去 7 天内与资源 “kube-controller-manager” 关联的请求和响应

SELECT activity_name, time_dt, api.request, api.response, resource.name FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_eks_audit_2_0", UNNEST(resources) AS t(resource) WHERE time_dt BETWEEN CURRENT_TIMESTAMP - INTERVAL '7' DAY AND CURRENT_TIMESTAMP AND resource.name = 'kube-controller-manager' LIMIT 25

查询 AWS WAF v2 日志

AWS WAF 是一种 Web 应用程序防火墙,可用于监控最终用户向您的应用程序发送的 Web 请求并控制对您的内容的访问。

以下是一些查询的示例 AWS WAF v2 日志:

在过去 7 天内发布来自特定源 IP 的请求

SELECT time_dt, activity_name, src_endpoint.ip, http_request.url.path, http_request.url.hostname, http_request.http_method, http_request.http_headers FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_waf_2_0" WHERE time_dt BETWEEN CURRENT_TIMESTAMP - INTERVAL '7' DAY AND CURRENT_TIMESTAMP AND src_endpoint.ip = '100.123.123.123' AND activity_name = 'Post' LIMIT 25

过去 7 天内与防火墙类型 MANAGED RULE _ _ GROUP 匹配的请求

SELECT time_dt, activity_name, src_endpoint.ip, http_request.url.path, http_request.url.hostname, http_request.http_method, firewall_rule.uid, firewall_rule.type, firewall_rule.condition, firewall_rule.match_location, firewall_rule.match_details, firewall_rule.rate_limit FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_waf_2_0" WHERE time_dt BETWEEN CURRENT_TIMESTAMP - INTERVAL '7' DAY AND CURRENT_TIMESTAMP AND firewall_rule.type = 'MANAGED_RULE_GROUP' LIMIT 25

过去 7 天内与防火墙REGEX中的规则相匹配的请求

SELECT time_dt, activity_name, src_endpoint.ip, http_request.url.path, http_request.url.hostname, http_request.http_method, firewall_rule.uid, firewall_rule.type, firewall_rule.condition, firewall_rule.match_location, firewall_rule.match_details, firewall_rule.rate_limit FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_waf_2_0" WHERE time_dt BETWEEN CURRENT_TIMESTAMP - INTERVAL '7' DAY AND CURRENT_TIMESTAMP AND firewall_rule.condition = 'REGEX' LIMIT 25

的获取请求被拒绝 AWS 触发的凭证 AWS WAF 过去 7 天的规则

SELECT time_dt, activity_name, action, src_endpoint.ip, http_request.url.path, http_request.url.hostname, http_request.http_method, firewall_rule.uid, firewall_rule.type FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_waf_2_0" WHERE time_dt BETWEEN CURRENT_TIMESTAMP - INTERVAL '7' DAY AND CURRENT_TIMESTAMP AND http_request.url.path = '/.aws/credentials' AND action = 'Denied' LIMIT 25

获取请求 AWS 过去 7 天内按国家分组的证书

SELECT count(*) as Total, src_endpoint.location.country AS Country, activity_name, action, src_endpoint.ip, http_request.url.path, http_request.url.hostname, http_request.http_method FROM "amazon_security_lake_glue_db_us_east_1"."amazon_security_lake_table_us_east_1_waf_2_0" WHERE time_dt BETWEEN CURRENT_TIMESTAMP - INTERVAL '7' DAY AND CURRENT_TIMESTAMP AND activity_name = 'Get' AND http_request.url.path = '/.aws/credentials' GROUP BY src_endpoint.location.country, activity_name, action, src_endpoint.ip, http_request.url.path, http_request.url.hostname, http_request.http_method