Docker 上适用于 Windows 的 Google Security Operations 转发器
本文档介绍了如何在 Docker 上安装和配置适用于 Windows 的 Google Security Operations 转发器。
系统要求
下面是一些常规建议。如需了解专门针对您的系统的建议,请与 Google 安全运营支持团队联系。
- Windows Server 版本:Microsoft Windows Server 2022 支持 Google Security Operations 转发器。
- RAM:收集的每种日志类型为 1.5 GB。例如,端点检测和响应 (EDR)、DNS 和 DHCP 都是单独的日志类型。您需要 4.5 GB 的 RAM 才能收集这三者的数据。如需查看支持的默认解析器和日志类型的列表,请参阅支持的默认解析器。
- CPU:2 个 CPU 足以处理所有数据类型总共不到 10,000 个每秒事件 (EPS)。如果您预计发送的 EPS 超过 10,000 个,则需要 4 到 6 个 CPU。
磁盘:无论 Google Security Operations 转发器处理多少数据,100 MB 的磁盘空间都已足够。您可以通过在配置文件中添加
write_to_disk_buffer_enabled
和write_to_disk_dir_path
参数来缓冲磁盘。例如:
- <collector>: common: ... write_to_disk_buffer_enabled: true write_to_disk_dir_path: directory_path ...
Google IP 地址范围
在设置 Google Security Operations 转发器配置时(例如在设置防火墙配置时),您可能需要打开 IP 地址范围。Google 无法提供具体的 IP 地址列表。 不过,您可以获取 Google IP 地址范围。
验证防火墙配置
如果您在 Google Security Operations 转发器容器和互联网之间设置了防火墙或经过身份验证的代理,则它们需要使用规则来允许访问以下 Google Cloud 主机:
连接类型 | 目标 | 端口 |
TCP | malachiteingestion-pa.googleapis.com | 443 |
TCP | asia-northeast1-malachiteingestion-pa.googleapis.com | 443 |
TCP | asia-south1-malachiteingestion-pa.googleapis.com | 443 |
TCP | asia-southeast1-malachiteingestion-pa.googleapis.com | 443 |
TCP | australia-southeast1-malachiteingestion-pa.googleapis.com | 443 |
TCP | europe-malachiteingestion-pa.googleapis.com | 443 |
TCP | europe-west2-malachiteingestion-pa.googleapis.com | 443 |
TCP | europe-west3-malachiteingestion-pa.googleapis.com | 443 |
TCP | europe-west6-malachiteingestion-pa.googleapis.com | 443 |
TCP | europe-west12-malachiteingestion-pa.googleapis.com | 443 |
TCP | me-central1-malachiteingestion-pa.googleapis.com | 443 |
TCP | me-central2-malachiteingestion-pa.googleapis.com | 443 |
TCP | me-west1-malachiteingestion-pa.googleapis.com | 443 |
TCP | northamerica-northeast2-malachiteingestion-pa.googleapis.com | 443 |
TCP | accounts.google.com | 443 |
TCP | gcr.io | 443 |
TCP | oauth2.googleapis.com | 443 |
TCP | storage.googleapis.com | 443 |
您可以按照以下步骤检查与 Google Cloud 的网络连接:
以管理员权限启动 Windows PowerShell(点击开始,输入
PowerShell
,右键点击 Windows PowerShell,然后点击以管理员身份运行)。运行以下命令:
C:\> test-netconnection <host> -port <port>
该命令返回
TcpTestSucceeded
为true
。例如:
C:\> test-netconnection malachiteingestion-pa.googleapis.com -port 443 ComputerName : malachiteingestion-pa.googleapis.com RemoteAddress : 198.51.100.1 RemotePort : 443 InterfaceAlias : Ethernet SourceAddress : 203.0.113.1 TcpTestSucceeded : True
在 Microsoft Windows 上安装 Docker
本部分介绍如何使用命令行界面和 PowerShell 在 Microsoft Windows 上安装 Docker。
使用容器的 Google Security Operations 转发器具有以下优势:
- 通过隔离提供更好的安全性:
- 客户环境和要求不会影响 Google Security Operations 转发器。
- Google Security Operations 转发器环境和要求不会影响客户。
- 容器分发机制已存在,且可为 Google Cloud 和客户专用且单独的机制。如需了解详情,请参阅 Artifact Registry。
在 Microsoft Windows Server Core 2022 上完成以下步骤。
启用 Microsoft Windows 容器功能。
Install-WindowsFeature containers -Restart
在 PowerShell 管理员模式下执行以下命令,以安装 Docker CE:
Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/Windows-Containers/Main/helpful_tools/Install-DockerCE/install-docker-ce.ps1" -o install-docker-ce.ps1 .\install-docker-ce.ps1
通过运行
docker ps
命令来测试 Docker 命令行界面,该命令会返回正在运行的容器的列表。如果该命令没有列出任何正在运行的容器,则安装成功。如果 Docker 未正确安装,系统会显示错误。如需了解详情,请参阅使用入门:为容器准备窗口。
对于企业部署,请安装 Mirantis Container Runtime(也称为 Docker EE)。
配置 Google Security Operations 转发器
如需在 Docker 上为 Windows 配置 Google Security Operations 转发器,请参阅通过 Google Security Operations 界面管理转发器配置。
配置 Google Security Operations 转发器时,请确保转发器中的所有路径都以“c:”前缀开头。
Google Security Operations 转发器会在 5 分钟内自动应用对配置文件所做的任何更改。
如需在 Docker 上使用 Windows 版 Google Security Operations 转发器收集数据包数据,请参阅收集数据包数据。
在 Docker 容器中运行 Google Security Operations 转发器
如果要升级 Google Security Operations 转发器,请先清理之前的 Docker 运行作业。在以下示例中,Docker 容器的名称为
cfps
。docker stop cfps docker rm cfps
使用此 Docker 拉取命令从 Google Cloud 获取最新的 Docker 映像。
docker pull gcr.io/chronicle-container/cf_production_stable_windows
从 Docker 容器启动 Google Security Operations 转发器。
docker run ` --detach ` --name cfps ` --restart=always ` --log-opt max-size=100m ` --log-opt max-file=10 ` -p 10514:10514 ` -v C:\config\:C:/opt/chronicle/external ` gcr.io/chronicle-container/cf_production_stable_windows
您可以使用多个选项或多个范围添加多个端口。例如:
-p 3001:3000 -p 2023:2022
或-p 7000-8000:7000-8000
查看转发器日志
如需查看 Google Security Operations 转发器日志,请执行以下命令:
sudo docker logs cfps
如需查看存储日志的文件的路径,请执行如下命令:
docker inspect --format='{{.LogPath}}' CONTAINER_NAME
如需查看实时运行日志,请执行以下命令:
sudo docker logs cfps -f
如需将日志存储在文件中,请执行以下命令:
sudo docker logs cfps &> logs.txt
卸载 Google Security Operations 转发器
通过以下 Docker 命令,您可以停止、卸载或移除 Google Security Operations 转发器。
以下命令会停止 Google Security Operations 转发器容器:
docker stop cfps
以下命令会移除 Google Security Operations 转发器容器:
docker rm cfps
升级 Google Security Operations 转发器
Docker 上 Windows 版 Google Security Operations 转发器会在 Docker 映像中使用 Shell 脚本不断更新,因此无需为此提供任何可执行文件。
收集数据
以下部分可帮助您配置 Google Security Operations 转发器,以注入不同类型的数据,这些数据会转发到 Google Security Operations 实例。
请勿为 batch_n_bytes
配置大于 1 MB 的值。如果您配置的值大于 1 MB,系统会自动将该值重置为 1 MB。
收集 Splunk 数据
您可以配置 Google Security Operations 转发器,以将 Splunk 数据转发到 Google Security Operations。Google Cloud 使用以下信息配置 Google Security Operations 转发器,以从 Splunk 转发您的数据:
Splunk REST API 的网址(例如
https://10.0.113.15:8089
)。为每种必需的数据类型(例如
index=dns
)生成数据的 Splunk 查询。
FORWARDER_NAME.conf output: collectors: - splunk: common: enabled: true data_type: WINDOWS_DNS data_hint: "#fields ts uid id.orig_h id.orig_p id.resp_h id.resp_p proto trans_id query qclass qclass_name" batch_n_seconds: 10 batch_n_bytes: 819200 url: https://127.0.0.1:8089 is_ignore_cert: true minimum_window_size: 10s maximum_window_size: 30s query_string: search index=* sourcetype=dns query_mode: realtime
- 将您的 Splunk 帐号凭据提供给 Google Security Operations 转发器。为此,您可以创建一个
creds.txt
文件。
如需使用 creds.txt
文件,请执行以下操作:
为您的 Splunk 凭据创建一个本地文件,并将其命名为
creds.txt
。将用户名放在第一行,将密码放在第二行:
cat creds.txt myusername mypassword
如需使用 Google Security Operations 转发器访问 Splunk 实例,请将
creds.txt
文件复制到配置目录(配置文件所在的目录)。例如:cp creds.txt c:/opt/chronicle/config/creds.txt
验证
creds.txt
文件是否位于正确的位置:ls c:/opt/chronicle/config
收集 Syslog 数据
Google Security Operations 转发器可用作 Syslog 服务器。您可以配置任何支持通过 TCP 或 UDP 连接发送 Syslog 数据的设备或服务器,以将其数据转发到 Google Security Operations 转发器。您可以控制设备或服务器向 Google Security Operations 转发器发送的确切数据。然后,Google Security Operations 转发器可以将数据转发到 Google Security Operations。
FORWARDER_NAME.conf
配置文件(由 Google Cloud 提供)指定要针对每种类型的转发数据监控的端口(例如端口 10514)。默认情况下,Google Security Operations 转发器接受 TCP 和 UDP 连接。
配置 rsyslog
如需配置 rsyslog,您需要为每个端口(例如,每种数据类型)指定目标。请查阅系统文档,了解正确的语法。以下示例展示了 rsyslog 目标配置:
TCP 日志流量:
dns.* @@192.168.0.12:10514
UDP 日志流量:
dns.* @192.168.0.12:10514
为 syslog 配置启用 TLS
您可以为与 Google Security Operations 转发器的 syslog 连接启用 TLS。在 Google Security Operations 转发器配置文件 (FORWARDER_NAME.conf
) 中,指定您自己生成的证书和证书密钥的位置,如以下示例所示:
证书 | c:/opt/chronicle/external/certs/client_generated_cert.pem |
certificate_key | c:/opt/chronicle/external/certs/client_generated_cert.key |
根据显示的示例,修改 Google Security Operations 转发器配置文件 (FORWARDER_NAME.conf
),如下所示:
collectors: - syslog: common: enabled: true data_type: WINDOWS_DNS data_hint: batch_n_seconds: 10 batch_n_bytes: 1048576 tcp_address: 0.0.0.0:10515 tcp_buffer_size: 65536 connection_timeout_sec: 60 certificate: "c:/opt/chronicle/external/certs/client_generated_cert.pem" certificate_key: "c:/opt/chronicle/external/certs/client_generated_cert.key" minimum_tls_version: "TLSv1_3"
需要注意的几个要点:
您可以配置 TCP 缓冲区空间。默认 TCP 缓冲区空间为 64KB
connection_timeout
的默认和推荐值为 60 秒。如果连接处于非活动状态的时间达到指定的时间,TCP 连接就会终止。系统会根据输入请求的 TLS 版本检查最低的 TLS 版本。输入请求的 TLS 版本应高于最低 TLS 版本。最低 TLS 版本应为以下值之一:
TLSv1_0
、TLSv1_1
、TLSv1_2
、TLSv1_3
。
您可以在配置目录下创建证书目录,并将证书文件存储在该目录下。
收集文件数据
文件收集器旨在从文件中提取日志。该文件应该绑定到 Docker 容器。
如果要从单个日志文件手动上传日志,请使用此方式。这可用于回填特定日志文件的日志。
从 Docker 容器启动 Google Security Operations 转发器:
docker run ` --name cfps ` --log-opt max-size=100m ` --log-opt max-file=10 ` -p 10514:10514 ` -v c:/opt/chronicle/config:c:/opt/chronicle/external ` -v c:/var/log/crowdstrike/falconhoseclient:c:/opt/chronicle/edr ` gcr.io/chronicle-container/cf_production_stable
您可以使用多个选项或多个范围添加多个端口。例如:-p 3001:3000 -p 2023:2022
或 -p 7000-8000:7000-8000
此 docker run
命令对于将加载量映射到容器至关重要。
根据此示例,您应该按如下方式修改 Google Security Operations 转发器配置(FORWARDER_NAME.conf
文件)。sample.txt
文件应位于 /var/log/crowdstrike/falconhostclient
文件夹中。
collectors: - file: common: enabled: true data_type: CS_EDR data_hint: batch_n_seconds: 10 batch_n_bytes: 1048576 file_path: c:/opt/chronicle/edr/output/sample.txt filter:
标记配置
skip_seek_to_end
(bool):此标志默认设置为 false
,并且文件输入仅发送新的日志行作为输入。将此值设置为 true
会导致在转发器重启期间再次发送之前的所有日志行。这会导致日志重复。在某些情况下(例如,在服务中断期间),将此标志设置为 true
很有用,因为重启转发器会再次发送缺少的日志行。
poll
(bool):文件收集器使用 Tail 库检查文件系统中的任何更改。通过将此标志设置为 true
,Tail 库会使用轮询方法,而不是默认的通知方法。
收集数据包数据
在 Windows 系统上,Google Security Operations 转发器可以使用 Npcap 直接从网络接口捕获数据包。
系统捕获数据包并将其发送到 Google Cloud,而不是日志条目。捕获仅从本地接口完成。
与 Google Security Operations 支持团队联系,以更新您的 Google Security Operations 转发器配置文件以支持数据包捕获。
如需运行数据包捕获 (PCAP) 转发器,您需要以下各项:
在 Microsoft Windows 主机上安装 Npcap。
向 Google Security Operations 转发器授予 root 权限或管理员权限,以监控网络接口。
无需命令行选项。
安装 Npcap 时,启用 WinPcap 兼容模式。
如需配置 PCAP 转发器,Google Cloud 需要用于捕获数据包的接口的 GUID。在计划安装 Google Security Operations 转发器的机器上(服务器或监听 span 端口的机器)运行 getmac.exe
,并将输出发送到 Google Security Operations。
或者,您可以修改配置文件。找到 PCAP 部分,然后将接口旁边显示的 GUID 值替换为运行 getmac.exe 时显示的 GUID。
例如,以下是原始 PCAP 部分:
- pcap:
common:
enabled: true
data_type: PCAP_DNS
batch_n_seconds: 10
batch_n_bytes: 1048576
interface: \Device\NPF_{1A7E7C8B-DD7B-4E13-9637-0437AB1A12FE}
bpf: udp port 53
运行 getmac.exe
后的输出如下所示:
C:\>getmac.exe
Physical Address Transport Name
===========================================================================
A4-73-9F-ED-E1-82 \Device\Tcpip_{2E0E9440-ABFF-4E5B-B43C-E188FCAD1234}
最后,下面是修订后的 PCAP 部分以及新的 GUID:
- pcap:
common:
enabled: true
data_type: PCAP_DNS
batch_n_seconds: 10
batch_n_bytes: 1048576
interface: \Device\NPF_{2E0E9440-ABFF-4E5B-B43C-E188FCAD9734}
bpf: udp port 53
从 Kafka 主题收集数据
您可以像从 Syslog 一样从 Kafka 主题中注入数据。使用者群组允许您部署最多三个 Google Security Operations 转发器,并从同一 Kafka 主题拉取数据。如需了解详情,请参阅 Kafka。
如需详细了解 Kafka 使用者群组,请参阅 Kafka 使用者群组
配置示例:Kafka 输入
以下 Google Security Operations 转发器配置展示了如何设置 Google Security Operations 转发器,以便从 Kafka 主题中注入数据。
FORWARDER_NAME.conf
文件
collectors: - kafka: common: batch_n_bytes: 1048576 batch_n_seconds: 10 data_hint: null data_type:NIX_SYSTEM
enabled: true topic: example-topic group_id: chronicle-forwarder timeout: 60s brokers: ["broker-1:9092", "broker-2:9093"] tls: insecureSkipVerify: true certificate: "c:/path/to/cert.pem" certificate_key: "c:/path/to/cert.key" - syslog: common: batch_n_bytes: 1048576 batch_n_seconds: 10 data_hint: null data_type:WINEVTLOG
enabled: true tcp_address: 0.0.0.0:30001 connection_timeout_sec: 60
FORWARDER_NAME_auth.conf
文件
collectors: - kafka: username: user password: password - syslog:
收集 WebProxy 数据
Google Security Operations 转发器可以使用 Npcap 直接从网络接口捕获 WebProxy 数据并将其发送到 Google Cloud。
如需为您的系统启用 WebProxy 数据捕获功能,请与 Google Security Operations 支持团队联系。
在运行 WebProxy 转发器之前,请执行以下操作:
在 Microsoft Windows 主机上安装 Npcap。在安装过程中启用 WinPcap 兼容模式。
向 Google Security Operations 转发器授予 root 权限或管理员权限,以监控网络接口。
如需配置 WebProxy 转发器,Google Cloud 需要用于捕获 WebProxy 数据包的接口的 GUID。
在要安装 Google Security Operations 转发器的机器上运行
getmac.exe
,并将输出发送到 Google Security Operations。或者,您可以修改配置文件。找到 WebProxy 部分,然后将接口旁边显示的 GUID 替换为运行getmac.exe
后显示的 GUID。修改 Google Security Operations 转发器配置 (
FORWARDER_NAME.conf
) 文件,如下所示:- webproxy: common: enabled : true data_type: <Your LogType> batch_n_seconds: 10 batch_n_bytes: 1048576 interface: \Device\NPF_{2E0E9440-ABFF-4E5B-B43C-E188FCAD9734} bpf: tcp and dst port 80
自定义配置
下表列出了转发器配置文件中使用的重要参数。
参数 | 说明 |
---|---|
data_type | 收集器可以收集和处理的日志数据类型。 |
元数据 | 元数据,用于替换全局元数据。 |
max_file_buffer_bytes | 磁盘或文件缓冲区中可累积的字节数上限。默认值为 1073741824 ,即 1 GB。 |
max_memory_buffer_bytes | 内存缓冲区中可累积的字节数上限。默认值为 1073741824 ,即 1 GB。 |
write_to_disk_dir_path | 用于文件或磁盘缓冲区的路径。 |
write_to_disk_buffer_enabled | 如果为 true ,则使用磁盘缓冲区而不是内存缓冲区。默认值为 false 。 |
batch_n_bytes | 收集器可以累积的字节数上限(达到此上限后将对数据进行批处理)。默认值为 1048576 ,即 1 MB。 |
batch_n_seconds | 对收集器收集的数据进行批处理的秒数。默认值为 11 秒。 |
data_hint | 收集器可以接收的数据格式(通常是描述格式的日志文件标头)。 |
如需查看配置文件中使用的参数的详尽列表,请参阅转发器配置字段和收集器配置字段。
切换数据压缩
日志压缩可减少将日志传输到 Google Security Operations 时的网络带宽消耗。不过,压缩可能会导致 CPU 使用量增加。 CPU 使用率和带宽之间的权衡取决于许多因素,包括日志数据类型、这些数据的可压缩性、运行 Google Security Operations 转发器的主机上的 CPU 周期可用性,以及减少网络带宽消耗的需求。
例如,基于文本的日志可以很好地压缩,并且可以在低 CPU 使用率的情况下显著节省带宽。但是,原始数据包的加密载荷不能很好地压缩,并且会产生更高的 CPU 使用率。
默认情况下,日志压缩处于停用状态。启用日志压缩可能会减少带宽消耗。不过,启用日志压缩功能也可能会增加 CPU 使用量。请注意权衡利弊。
如需启用日志压缩,请在 Google Security Operations 转发器配置文件中将 compression
字段设置为 true
,如以下示例所示:
FORWARDER_NAME.conf
文件
output: compression: true url: malachiteingestion-pa.googleapis.com:443 identity: identity: collector_id: 10479925-878c-11e7-9421-10604b7cb5c1 customer_id: ebdc4bb9-878b-11e7-8455-10604b7cb5c1 ...
FORWARDER_NAME_auth.conf
文件
output: identity: secret_key: | { "type": "service_account", ... }
配置磁盘缓冲
磁盘缓冲允许您将积压的消息缓冲到磁盘,而不是内存。系统可以存储积压的消息,以防 Google Security Operations 转发器崩溃或底层主机崩溃。请注意,启用磁盘缓冲可能会影响性能。
如果停用磁盘缓冲,Google Security Operations 转发器会为每个日志类型(例如,每种连接器)使用 1 GB 的内存 (RAM)。指定 max_memory_buffer_bytes
配置参数。允许的最大内存为 4 GB。
您可以将自动磁盘缓冲配置为在收集器之间使用动态共享的缓冲区,以便更好地应对流量高峰。如需启用动态共享缓冲区,请在转发器配置中添加以下内容:
auto_buffer: enabled: true target_memory_utilization: 80
如果已启用自动磁盘缓冲,但未定义 target_memory_utilization
,则它会使用默认值 70
。
如果您使用 Docker 运行 Google Security Operations 转发器,Google 建议您装载一个与配置卷分开的卷,以实现隔离。此外,每个输入都应与其自己的目录或卷隔离,以避免冲突。
配置示例:磁盘缓冲
以下配置包括用于启用磁盘缓冲的语法:
collectors: - syslog: common: write_to_disk_buffer_enabled: true # c:/buffers/NIX_SYSTEM
is part of the external mounted volume for the forwarder write_to_disk_dir_path: c:/buffers/NIX_SYSTEM
max_file_buffer_bytes: 1073741824 batch_n_bytes: 1048576 batch_n_seconds: 10 data_hint: null data_type:NIX_SYSTEM
enabled: true tcp_address: 0.0.0.0:30000 connection_timeout_sec: 60 - syslog: common: batch_n_bytes: 1048576 batch_n_seconds: 10 data_hint: null data_type:WINEVTLOG
enabled: true tcp_address: 0.0.0.0:30001 connection_timeout_sec: 60
设置正则表达式过滤条件
借助正则表达式过滤条件,您可以根据正则表达式与原始日志匹配来过滤日志。
过滤器采用 RE2 语法。syntax
过滤条件必须包含正则表达式,并视需要定义匹配时的行为。匹配项的默认行为是块(您也可以明确将其配置为块)。
或者,您也可以使用 allow
行为指定过滤条件。如果您指定任何 allow
过滤条件,则 Google Security Operations 转发器会屏蔽与至少一个 allow
过滤条件不匹配的任何日志。
您可以定义任意数量的过滤条件。块过滤条件优先于 allow
过滤条件。
定义过滤器时,必须为其指定名称。系统将使用转发器运行状况指标向 Google Security Operations 报告有效过滤器的名称。在配置的根位置定义的过滤器会与在收集器级别定义的过滤器合并。如果名称存在冲突,则收集器级别的过滤条件优先。如果未在根级别或收集器级别定义任何过滤器,则行为是允许所有过滤器。
配置示例:正则表达式过滤条件
在以下 Google Security Operations 转发器配置中,系统会阻止与根过滤条件 (allow_filter
) 不匹配的 WINEVTLOG
日志。如果指定正则表达式,则该过滤条件将仅允许优先级介于 0 到 99 之间的日志。但是,尽管 allow_filter
,任何包含“foo”或“bar”的 NIX_SYSTEM
日志都会被阻止。这是因为过滤条件使用逻辑“或”(OR)。在触发过滤条件之前,系统会处理所有日志。
regex_filters: allow_filter: regexp: ^<[1-9][0-9]?$>.*$ behavior_on_match: allow collectors: - syslog: common: regex_filters: block_filter_1: regexp: ^.*foo.*$ behavior_on_match: block block_filter_2: regexp: ^.*bar.*$ batch_n_bytes: 1048576 batch_n_seconds: 10 data_hint: null data_type:NIX_SYSTEM
enabled: true tcp_address: 0.0.0.0:30000 connection_timeout_sec: 60 - syslog: common: batch_n_bytes: 1048576 batch_n_seconds: 10 data_hint: null data_type:WINEVTLOG
enabled: true tcp_address: 0.0.0.0:30001 connection_timeout_sec: 60
配置任意标签
标签用于使用键值对将任意元数据附加到日志。可以为整个 Google Security Operations 转发器或 Google Security Operations 转发器的特定收集器配置标签。如果两者同时提供,则标签会与收集器的密钥合并,如果密钥重叠,则优先于 Google Security Operations 转发器的密钥。
配置示例:任意标签
在以下 Google Security Operations 转发器配置中,foo=bar
和 meow=mix
键值对都附加到 WINEVTLOG
日志,foo=baz
和 meow=mix
键值对附加到 NIX_SYSTEM
日志。
metadata: labels: foo: bar meow: mix collectors: syslog: common: metadata: labels: foo: baz meow: mix batch_n_bytes: 1048576 batch_n_seconds: 10 data_hint: null data_type:NIX_SYSTEM
enabled: true tcp_address: 0.0.0.0:30000 connection_timeout_sec: 60 syslog: common: batch_n_bytes: 1048576 batch_n_seconds: 10 data_hint: null data_type:WINEVTLOG
enabled: true tcp_address: 0.0.0.0:30001 connection_timeout_sec: 60
配置命名空间
使用命名空间标签来标识来自不同网络段的日志,并解决重叠的 IP 地址冲突。您可以为整个 Google Security Operations 转发器或 Google Security Operations 转发器的特定收集器配置命名空间标签。如果同时包含这两项,则特定收集器的命名空间优先。
为 Google Security Operations 转发器配置的任何命名空间都会与关联资源一起显示在 Google Security Operations 界面中。您还可以使用 Google Security Operations 搜索功能搜索命名空间。
如需了解如何在 Google Security Operations 界面中查看命名空间,请参阅此处。
配置示例:命名空间
在以下 Google Security Operations 转发器配置中,WINEVTLOG
日志附加到 FORWARDER 命名空间,NIX_SYSTEM
日志附加到 CORPORATE 命名空间。
metadata: namespace: FORWARDER collectors: - syslog: common: metadata: namespace: CORPORATE batch_n_bytes: 1048576 batch_n_seconds: 10 data_hint: null data_type:NIX_SYSTEM
enabled: true tcp_address: 0.0.0.0:30000 connection_timeout_sec: 60 - syslog: common: batch_n_bytes: 1048576 batch_n_seconds: 10 data_hint: null data_type:WINEVTLOG
enabled: true tcp_address: 0.0.0.0:30001 connection_timeout_sec: 60
配置负载均衡和高可用性选项
在 Docker 上,适用于 Windows 的 Google Security Operations 转发器可以部署在数据源和 Google Security Operations 转发器实例之间安装第 4 层负载均衡器的环境中。这样,您就可以在多个 Google Security Operations 转发器之间分配日志收集,或者在某个 Google Security Operations 转发器出现故障时将日志发送到其他 Google Security Operations 转发器。只有 Syslog 集合类型支持此功能。
Docker 上适用于 Windows 的 Google Security Operations 转发器包含一个内置 HTTP 服务器,可响应来自负载均衡器的 HTTP 健康检查。HTTP 服务器还有助于确保在 Google Security Operations 转发器启动或关闭期间不会丢失日志。
在 Google Security Operations 转发器配置文件的 server
部分中,配置 HTTP 服务器、负载均衡和高可用性选项。这些选项支持设置返回的超时持续时间和状态代码,以响应在容器调度器、基于编排的部署以及传统负载平衡器中收到的健康检查。
使用以下网址路径进行健康状况、就绪性和活跃性检查。<host:port>
值是在 Google Security Operations 转发器配置中定义的。
http://<host:port>/meta/available
:对容器调度器/编排器(如 Kubernetes)的活跃性检查。http://<host:port>/meta/ready
:就绪性检查和传统负载平衡器健康检查。
以下 Google Security Operations 转发器配置是负载均衡和高可用性的一个示例:
collectors: - syslog: common: batch_n_bytes: 1048576 batch_n_seconds: 10 data_hint: null data_type:NIX_SYSTEM
enabled: true tcp_address: 0.0.0.0:30000 connection_timeout_sec: 60 - syslog: common: batch_n_bytes: 1048576 batch_n_seconds: 10 data_hint: null data_type:WINEVTLOG
enabled: true tcp_address: 0.0.0.0:30001 connection_timeout_sec: 60 server: graceful_timeout: 15s drain_timeout: 10s http: port: 8080 host: 0.0.0.0 read_timeout: 3s read_header_timeout: 3s write_timeout: 3s idle_timeout: 3s routes: - meta: available_status: 204 ready_status: 204 unready_status: 503
配置路径 | 说明 |
---|---|
server : graceful_timeout | Google Security Operations 转发器返回错误的就绪性/健康检查但仍接受新连接的时间。这也是在收到停止信号和实际开始关闭服务器之间等待的时间。这样,负载均衡器就有时间从池中移除 Google Security Operations 转发器。 |
server : drain_timeout | Google Security Operations 转发器在被服务器关闭之前等待活动连接自行成功关闭的时间。 |
server : http : port | HTTP 服务器用于监听来自负载均衡器的健康检查的端口号。必须介于 1024-65535 之间。 |
server : http : host | 可解析为 IP 地址的 IP 地址或主机名,服务器应监听此类地址。如果为空,则默认值为本地系统 (0.0.0.0)。 |
server : http : read_timeout | 用于微调 HTTP 服务器。通常保留默认设置即可,无需更改。读取整个请求(包括标头和正文)的最长时间。您可以同时设置 read_timeout 和 read_header_timeout。 |
server : http : read_header_timeout | 用于微调 HTTP 服务器。通常保留默认设置即可,无需更改。允许读取请求标头的最长时间。读取连接时,截止时间会在读取标头后重置。 |
server : http : write_timeout | 用于微调 HTTP 服务器。通常保留默认设置即可,无需更改。允许发送响应的最长时间。 读取新请求标头时,此值会重置。 |
server : http : idle_timeout | 用于微调 HTTP 服务器。通常保留默认设置即可,无需更改。启用空闲连接后,等待下一个请求的最长时间。如果 idil_timeout 为零,则使用 read_timeout 的值。如果两者均为零,则使用 read_header_timeout。 |
routes : meta : ready_status | 在以下任一情况下,Google Security Operations 转发器准备好接受流量时会返回状态代码:
|
routes : meta : unready_status | Google Security Operations 转发器在未准备好接受流量时返回的状态代码。 |
routes : meta : available_status | 收到活跃性检查且 Google Security Operations 转发器可用时,Google Security Operations 转发器返回的状态代码。Kubernetes 等容器调度器/编排器通常会发送活跃性检查。 |