手動管理轉送站設定檔
本頁說明如何手動建立及修改 Google Security Operations 轉送器設定檔。如要透過使用者介面設定轉送器 (建議做法),請參閱「透過 Google SecOps 使用者介面管理轉送器設定」。
每個已部署的 Google SecOps 轉送器都需要轉送器設定檔。轉送器設定檔會指定將資料轉移至 Google SecOps 執行個體的設定。
如要瞭解如何安裝及設定 Google SecOps 轉送器、系統需求,以及設定詳細資料,請參閱「安裝及設定轉送器」。
事前準備
建立設定檔前,請先規劃導入作業,瞭解可擷取的資料類型,以及需要在設定檔中定義的重要屬性。
建立設定檔
如要手動建立設定檔,請按照下列步驟操作:
使用下列命名慣例,將這兩個檔案儲存在同一個目錄中:
FORWARDER_NAME
.conf:使用這個檔案定義與記錄檔擷取相關的設定。FORWARDER_NAME
_auth.conf:使用這個檔案定義授權憑證。修改檔案,加入轉送站執行個體的設定。
如要進一步瞭解各類擷取機制 (例如 Splunk 或 Syslog) 的設定,請參閱在設定檔中定義資料類型。 如要瞭解如何自訂各項屬性 (例如資料壓縮或磁碟緩衝),請參閱「在設定檔中設定重要屬性」。
請確認
FORWARDER_NAME
_auth.conf 檔案中每個輸入內容都有對應項目,即使輸入內容沒有對應的驗證詳細資料也一樣。這是正確對應資料的必要條件。
轉送器會在五分鐘內自動套用對設定檔所做的任何變更。
範例設定
您可以參考下列設定檔範本,建立自己的設定檔。
兩個檔案的設定範例
這兩個檔案系統會將驗證憑證儲存在不同的檔案中,進一步確保安全無虞。您可以將 FORWARDER_NAME
.conf 檔案儲存在版本控制存放區或任何開放式設定管理系統中。您可以直接在執行轉送器的實體或虛擬機器中儲存 FORWARDER_NAME
_auth.conf 檔案。
下列程式碼範例顯示轉送器的設定檔格式。
FORWARDER_NAME.conf 檔案
output: url: {region}-chronicle.googleapis.com (for example: us-chronicle.googleapis.com) use_dataplane : true project_id: PROJECT_ID region: {region} (for example: {us}) identity: identity: collector_id: COLLECTOR_ID \ customer_id: CUSTOMER_ID \ collectors: - syslog: common: enabled: true data_type: "WINDOWS_DHCP" data_hint: batch_n_seconds: 10 batch_n_bytes: 1048576 tcp_address: 0.0.0.0:10514 udp_address: 0.0.0.0:10514 connection_timeout_sec: 60 tcp_buffer_size: 524288 - 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 connection_timeout_sec: 60 tcp_buffer_size: 524288
FORWARDER_NAME_auth.conf 檔案
output: identity: secret_key: | { "type": "service_account", "project_id": "PROJECT_ID" \, "private_key_id": "PRIVATE_KEY_ID" \, "private_key": "-----BEGIN PRIVATE KEY-----\\"PRIVATE_KEY" \n-----END PRIVATE KEY-----\n", "client_email": "CLIENT_EMAIL" \, "client_id": "CLIENT_ID" \, "auth_uri": "https://accounts.google.com/o/oauth2/auth", "token_uri": "https://oauth2.googleapis.com/token", "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/example-account-1%40example-account.iam.gserviceaccount.com" } collectors: - syslog: - syslog: certificate: "../forwarder/inputs/testdata/localhost.pem" certificate_key: "../forwarder/inputs/testdata/localhost.key"
單一檔案範例設定
output: url: us-chronicle.googleapis.com use_dataplane: true project_id: PROJECT_ID region: us identity: collector_id: COLLECTOR_ID \ customer_id: CUSTOMER_ID \ secret_key: | { "type": "service_account", "project_id": "PROJECT_ID" \, "private_key_id": "PRIVATE_KEY_ID" \, "private_key": "-----BEGIN PRIVATE KEY-----\ "PRIVATE_KEY" \n-----END PRIVATE KEY-----\n", "client_email": "CLIENT_EMAIL" \, "client_id": "CLIENT_ID" \, "auth_uri": "https://accounts.google.com/o/oauth2/auth", "token_uri": "https://oauth2.googleapis.com/token", "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/malachite-test-1%40malachite-test.iam.gserviceaccount.com" } collectors: - syslog: common: enabled: true data_type: "WINDOWS_DHCP" data_hint: batch_n_seconds: 10 batch_n_bytes: 1048576 tcp_address: 0.0.0.0:10514 udp_address: 0.0.0.0:10514 connection_timeout_sec: 60 tcp_buffer_size: 524288 - 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 connection_timeout_sec: 60 certificate: "../forwarder/inputs/testdata/localhost.pem" certificate_key: "../forwarder/inputs/testdata/localhost.key" tcp_buffer_size: 524288
從單一檔案轉換為雙檔案系統
如果您使用單一設定檔,並想改用雙檔案系統,請按照下列步驟操作:
複製現有的設定檔。
將其中一個檔案儲存為
FORWARDER_NAME
.conf 檔案,並從檔案中刪除授權憑證。將另一個檔案儲存為
FORWARDER_NAME
_auth.conf 檔案,並刪除檔案中所有非授權資料。您可以參考範例設定。請務必遵循「自訂設定」一節中提及的命名慣例和其他規範。
在設定檔中定義資料類型
以下各節將說明如何設定 Google SecOps 轉送器,以便擷取不同類型的資料,並轉送至 Google SecOps 執行個體。
Splunk 資料
您可以設定 Google SecOps 轉送器,將 Splunk 資料轉送至 Google SecOps。 Google Cloud 會使用下列資訊設定 Google SecOps 轉送器,從 Splunk 轉送資料:
Splunk REST API 的網址 (例如 https://10.0.113.15:8089)。
Splunk 查詢,用於為各個必要資料類型產生資料 (例如 index=dns)。
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
- 讓 Google SecOps 轉送器存取 Splunk 帳戶憑證。方法是建立
creds.txt
檔案。
如要使用 creds.txt
檔案,請按照下列步驟操作:
建立 Splunk 憑證的本機檔案,並命名為
creds.txt
。在第一行輸入使用者名稱,第二行輸入密碼:
cat creds.txt myusername mypassword
如要使用 Google SecOps 轉送器存取 Splunk 執行個體,請將
creds.txt
檔案複製到設定目錄 (與設定檔所在的目錄相同)。Linux
cp creds.txt /opt/chronicle/config/creds.txt
Windows
cp creds.txt c:/opt/chronicle/config/creds.txt
確認
creds.txt
檔案位於所需目錄:Linux
ls /opt/chronicle/config
Windows
ls c:/opt/chronicle/config
系統記錄檔資料
轉送器可做為系統記錄檔伺服器。您可以設定任何支援透過 TCP 或 UDP 連線傳送 Syslog 資料的伺服器,將資料轉送至 Google SecOps 轉送器。您可以控管伺服器傳送至轉送程式的資料,轉送程式隨後會將資料轉送至 Google SecOps。
FORWARDER_NAME.conf
設定檔 (由Google Cloud提供) 會指定要監控哪些通訊埠的轉送資料類型 (例如通訊埠 10514)。根據預設,Google SecOps 轉送器會接受 TCP 和 UDP 連線。
您可以自訂 TCP 緩衝區大小。預設 TCP 緩衝區大小為 64 KB。connection_timeout
的預設值和建議值為 60 秒。如果連線閒置超過 60 秒,系統就會終止 TCP 連線。
設定 rsyslog
如要設定 rsyslog,您必須為每個通訊埠 (例如每個資料類型) 指定目標。以下範例說明 rsyslog 目標設定:
TCP 記錄流量:
dns.* @@192.168.0.12:10514
UDP 記錄流量:
dns.* @192.168.0.12:10514
詳情請參閱系統說明文件。
為系統記錄設定啟用 TLS
您可以為 Syslog 連線啟用 TLS,將資料轉送至 Google SecOps。在轉送器設定檔 (FORWARDER_NAME
.conf) 中,指定您自行產生的憑證和憑證金鑰位置,如下列範例所示。您可以在 configuration
目錄下建立 certs
目錄,並將憑證檔案儲存在其中。
Linux:
憑證 | /opt/chronicle/external/certs/client_generated_cert.pem |
certificate_key | /opt/chronicle/external/certs/client_generated_cert.key |
Windows:
憑證 | c:/opt/chronicle/external/certs/client_generated_cert.pem |
certificate_key | c:/opt/chronicle/external/certs/client_generated_cert.key |
根據顯示的範例,修改轉送器設定檔 (FORWARDER_NAME
.conf),如下所示:
Linux:
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: "/opt/chronicle/external/certs/client_generated_cert.pem" certificate_key: "/opt/chronicle/external/certs/client_generated_cert.key" minimum_tls_version: "TLSv1_3"
Windows:
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"
輸入要求的 TLS 版本應高於最低 TLS 版本。最低 TLS 版本應為下列其中一個值:TLSv1_0、TLSv1_1、TLSv1_2、TLSv1_3。
檔案資料
檔案收集器的設計目的是從繫結至 Docker 容器的檔案擷取記錄。如要從單一記錄檔手動上傳記錄,可以使用這個選項。
從 Docker 容器啟動 Google SecOps 轉送器,將負載量對應至容器:
Linux
docker run
--detach
--name cfps
--log-opt max-size=100m
--log-opt max-file=10
--net=host
-v /opt/chronicle/config:/opt/chronicle/external
-v /var/log/crowdstrike/falconhostclient:/opt/chronicle/edr
gcr.io/chronicle-container/cf_production_stable
Windows
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/falconhostclient:c:/opt/chronicle/edr ` gcr.io/chronicle-container/cf_production_stable_windows
你可以使用多個選項或多個範圍新增多個通訊埠。例如:-p 3001:3000 -p 2023:2022
或 -p 7000-8000:7000-8000
。
範例程式碼中提供的通訊埠編號僅供參考。請視需要更換連接埠號碼。
根據這個範例,您可以修改 Google SecOps 轉送器設定 (FORWARDER_NAME.conf
檔案),如下所示:
Linux
collectors: - file: common: enabled: true data_type: CS_EDR data_hint: batch_n_seconds: 10 batch_n_bytes: 1048576 file_path: /opt/chronicle/edr/sample.txt filter:
Windows
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/sample.txt filter:
sample.txt
檔案應位於 /var/log/crowdstrike/falconhostclient
資料夾中。
旗標設定
skip_seek_to_end
(bool):此標記預設為 false
,且檔案輸入只會將新的記錄行做為輸入內容傳送。如果將此值設為 true
,轉送器重新啟動時,系統會再次傳送所有先前的記錄行。這會導致記錄重複。在特定情況下 (例如發生中斷時),將此旗標設為 true
很有幫助,因為重新啟動轉送器會再次傳送遺失的記錄檔行。
poll
(bool):檔案收集器會使用 Tail 程式庫檢查檔案系統是否有任何變更。將這個旗標設為 true
後,Tail 程式庫就會使用輪詢方法,而非預設的通知方法。
封包資料
Google SecOps 轉送器可以直接從網路介面擷取封包,而非記錄項目。
Linux 系統
Google SecOps 轉寄站可使用 Linux 上的 libcap 擷取封包。如要進一步瞭解 libcap,請參閱 libcap - Linux 說明文件頁面。
系統會擷取原始網路封包,並傳送至 Google SecOps,而非記錄項目。這項擷取作業僅限於本機介面。如要為系統啟用封包擷取功能,請與 Google SecOps 支援團隊聯絡。
Google SecOps 會使用 Berkeley Packet Filter (BPF) 運算式設定 Google SecOps 轉送器,以便擷取封包 (例如通訊埠 53,而非本機主機)。詳情請參閱「Berkeley 封包篩選器」。
Windows 系統
Google SecOps 轉送器可使用 Windows 系統上的 Npcap 擷取封包。
系統會擷取原始網路封包,並傳送至 Google SecOps,而非記錄項目。這項擷取作業僅限於本機介面。如要設定 Google SecOps 轉送器以擷取封包,請與 Google SecOps 支援團隊聯絡。
封包擷取 PCAP 轉送器須符合下列規定:
在 Microsoft Windows 主機上安裝 Npcap。
授予 Google SecOps 轉送器根層級或管理員權限,監控網路介面。
在 Npcap 安裝期間,啟用 WinPcap 相容模式。
如要設定 PCAP 轉送器, Google Cloud 需要用來擷取封包的介面 GUID。在要安裝 Google SecOps 轉送器的電腦上執行 getmac.exe
(伺服器或接聽範圍通訊埠的電腦),並將輸出內容傳送至 Google SecOps。
或者,您也可以修改設定檔。找到 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
「傳輸名稱」的 getmac.exe
輸出內容以 \Device\Tcpip
開頭,而可比較的 pcap 區段則以 \Device\NPF
開頭。
Kafka 主題的資料
Google SecOps 轉送器支援直接從 Kafka 主題擷取資料。您最多可以部署三個轉送器,並運用消費者群組的概念,從同一個 Kafka 主題提取資料,以進行有效率的平行處理。詳情請參閱 Kafka。如要進一步瞭解 Kafka 消費者群組,請參閱「Kafka 消費者」。
下列轉送器設定顯示如何設定轉送器,從 Kafka 主題擷取資料。
Linux
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: "/path/to/cert.pem" certificate_key: "/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:
Windows
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 SecOps 轉送器可直接從網路介面擷取 WebProxy 資料。
Linux
Google SecOps 轉送器可使用 Linux 上的 libcap 擷取 WebProxy 資料。如要進一步瞭解 libcap,請參閱 libcap - Linux 說明文件頁面。如要為系統啟用 WebProxy 資料擷取功能,請與 Google SecOps 支援團隊聯絡。
按照下列步驟修改 Google SecOps 轉送站設定 (FORWARDER_NAME.conf
檔案):
- webproxy:
common:
enabled : true
data_type: <Your LogType>
batch_n_seconds: 10
batch_n_bytes: 1048576
interface: any
bpf: tcp and dst port 80
Windows
轉送器可以使用 Npcap 擷取 WebProxy 資料,並傳送至 Google Cloud。
如要為系統啟用 WebProxy 資料擷取功能,請與 Google SecOps 支援團隊聯絡。
執行 WebProxy 轉送器前,請按照下列步驟操作:
在 Microsoft Windows 主機上安裝 Npcap。安裝時啟用 WinPcap 相容模式。
授予轉送器根層級或管理員權限,以便監控網路介面。
取得用於擷取 WebProxy 封包的介面 GUID。
在要安裝 Google SecOps 轉送器的機器上執行
getmac.exe
,然後將輸出內容傳送至 Google SecOps。或者,您也可以修改設定檔。找出 WebProxy 區段,然後將介面旁顯示的 GUID 替換為執行getmac.exe
後顯示的 GUID。按照下列步驟修改 Google SecOps 轉送站設定 (
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 | 收集器可接收的資料格式 (通常是描述格式的記錄檔標頭)。 |
如需設定檔中使用的參數完整清單,請參閱「轉送器設定欄位」和「收集器設定欄位」。
資料壓縮
記錄檔壓縮功能預設為停用。啟用記錄壓縮功能可減少頻寬用量。不過,啟用記錄壓縮功能也可能會增加 CPU 用量。根據您的環境和記錄資料評估取捨。
如要啟用記錄壓縮功能,請在 Google SecOps 轉送器設定檔中,將 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", ... }
磁碟緩衝
磁碟緩衝功能可讓您將待處理的訊息暫存至磁碟,而非記憶體。
您可以設定自動記憶體緩衝,在收集器之間使用動態共用緩衝區,更妥善處理流量尖峰。如要啟用動態共用緩衝區,請在轉送器設定中新增下列項目:
auto_buffer: enabled: true target_memory_utilization: 80
如果啟用自動磁碟緩衝,但未定義 target_memory_utilization
,系統會使用 70
的預設值。
如果您使用 Docker 執行轉送器,建議您掛接與設定磁碟區不同的磁碟區,以達到隔離效果。此外,每個輸入內容都應使用自己的目錄或磁碟區,以免發生衝突。
範例設定
下列設定包含啟用磁碟緩衝的語法:
collectors: - syslog: common: write_to_disk_buffer_enabled: true # /buffers/NIX_SYSTEM
is part of the external mounted volume for the forwarder write_to_disk_dir_path: /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 語法。 篩選器必須包含規則運算式,也可以選擇定義相符時的行為。
系統預設會在比對結果相符時執行 block
。您可以使用 allow
行為指定篩選器。如果您指定 allow
篩選器,轉送器會封鎖任何不符合至少一個 allow
篩選器的記錄。
您可以定義任意數量的篩選條件。Block
篩選器優先於 allow
篩選器。
定義篩選條件時,必須指派名稱。系統會透過轉送器健康狀態指標,向 Google SecOps 回報有效篩選器的名稱。在設定根層級定義的篩選條件,會與在收集器層級定義的篩選條件合併。如果名稱衝突,系統會優先採用收集器層級的篩選器。如果未在根層級或收集器層級定義任何篩選器,系統會允許所有記錄。
範例設定
在下列轉送器設定中,系統會封鎖不符合根篩選器 (allow_filter
) 的 WINEVTLOG
記錄。根據這個規則運算式,篩選器只會允許優先順序介於 0 到 99 的記錄。不過,含有「foo」或「bar」的任何 NIX_SYSTEM
記錄都會遭到封鎖,即使有 allow_filter
也一樣。這是因為篩選器使用邏輯 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
任意標籤
標籤用於使用鍵/值組合,將自訂中繼資料附加至記錄。 您可以為整個轉送器或轉送器的特定收集器設定標籤。如果兩者都有,且索引鍵重疊,收集器層級標籤會覆寫轉送器層級標籤。
範例設定
在下列轉送器設定中,「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 SecOps 使用者介面中。您也可以使用 Google SecOps Search 功能搜尋命名空間。
如要瞭解如何在 Google SecOps 使用者介面中查看命名空間,請參閱「資產命名空間」。
範例設定
在下列轉送器設定中,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
負載平衡和高可用性選項
您可以在轉送器設定檔的伺服器部分,設定 HTTP 伺服器、負載平衡和高可用性選項。這些選項支援設定逾時時間長度,以及在回應容器排程器和以協調為基礎的部署作業,以及負載平衡器收到的健康狀態檢查時傳回的狀態碼。
請使用下列網址路徑進行健康狀態、就緒和有效性檢查。
<host:port>
值是在轉送器設定中定義。
http://<host:port>/meta/available
:容器排程器或自動化調度管理工具的存活狀態檢查http://<host:port>/meta/ready
:完備性檢查和負載平衡器健康檢查
下列轉送器設定是負載平衡和高可用性的範例:
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 | 轉送器傳回不良的就緒/健康狀態檢查結果,但仍接受新連線的時間長度。這也是從收到停止訊號到實際開始關閉伺服器之間,需要等待的時間。這樣負載平衡器就有時間從集區中移除轉送器。 |
伺服器:drain_timeout | 轉送器等待有效連線自行順利關閉的時間長度,之後伺服器就會關閉連線。 |
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 伺服器。通常不需要變更預設設定。啟用閒置連線時,等待下一個要求的時間上限。如果 idle_timeout 為零,系統會使用 read_timeout 的值。如果兩者皆為零,系統會使用 read_header_timeout。 |
routes : meta : ready_status | 轉送器在下列任一情況下準備好接受流量時,傳回的狀態碼:
|
routes : meta : unready_status | 轉送器未準備好接受流量時傳回的狀態碼。 |
routes : meta : available_status | 轉送器收到即時性檢查要求且可用時,傳回的狀態碼。容器排程器或協調器通常會傳送存活狀態檢查。 |
還有其他問題嗎?向社群成員和 Google SecOps 專業人員尋求答案。