---
title: "Windows Event Log Forwarding: Cài đặt chi tiết từ đầu và kiểm tra hoạt động thực tế"
description: "Hướng dẫn cấu hình Windows Event Log Forwarding (WEF) bằng WinRM và wecutil từ đầu, gom log bảo mật RDP/Security về máy chủ tập trung và kiểm tra thực tế."
canonical: "https://thuecloud.vn/windows-event-log-forwarding-cai-dat-chi-tiet-tu-dau-va-kiem-tra-hoat-dong-thuc-te"
markdown_url: "https://thuecloud.vn/windows-event-log-forwarding-cai-dat-chi-tiet-tu-dau-va-kiem-tra-hoat-dong-thuc-te.md"
locale: "vi"
kind: "article"
published_at: "2026-11-22T16:18:30.616Z"
updated_at: "2026-11-22T16:18:29.248Z"
site: "ThueCloud.Vn"
estimated_tokens: 2304
---
# Windows Event Log Forwarding: Cài đặt chi tiết từ đầu và kiểm tra hoạt động thực tế

> Hướng dẫn cấu hình Windows Event Log Forwarding (WEF) bằng WinRM và wecutil từ đầu, gom log bảo mật RDP/Security về máy chủ tập trung và kiểm tra thực tế.

- Canonical HTML: https://thuecloud.vn/windows-event-log-forwarding-cai-dat-chi-tiet-tu-dau-va-kiem-tra-hoat-dong-thuc-te
- Markdown URL: https://thuecloud.vn/windows-event-log-forwarding-cai-dat-chi-tiet-tu-dau-va-kiem-tra-hoat-dong-thuc-te.md
- Organization: ThueCloud.Vn
- Support Email: support@thuecloud.vn
- Hotline: 03333 499 48
- Published: 2026-11-22
- Updated: 2026-11-22

## Mục lục

- Cấu hình trên máy chủ Collector (Windows Event Collector)
- Cấu hình trên VPS nguồn và kiểm tra hoạt động thực tế
- Bảng tóm tắt các Event ID quan trọng cần Forward
- Câu hỏi thường gặp (FAQ)
  - Dùng WEF qua cổng 5985 HTTP trong môi trường Workgroup có an toàn không?
  - Tại sao log Application và System đẩy về bình thường nhưng Security lại không thấy?
  - File ForwardedEvents.evtx trên Collector phình to quá mức thì giới hạn thế nào?

Khi quản lý nhiều máy chủ [VPS Việt Nam](https://thuecloud.vn/vps-viet-nam) chạy Windows Server, việc đăng nhập RDP vào từng máy để kiểm tra nhật ký đăng nhập thất bại hay lỗi ứng dụng rất mất thời gian. Tệ hơn, nếu một máy bị xâm nhập, kẻ tấn công thường xóa sạch Event Log cục bộ để phi tang dấu vết. **Windows Event Log Forwarding (WEF)** là tính năng tích hợp sẵn giúp đẩy toàn bộ log quan trọng về một máy chủ thu thập (Collector) tập trung theo thời gian thực mà không cần cài thêm agent bên thứ ba.

> **Tóm tắt nhanh (TL;DR):**
> - **Hai vai trò rõ ràng:** Máy chủ thu thập chạy dịch vụ **Windows Event Collector (`wecsvc`)**, các VPS nguồn chạy **WinRM (`winrm`)** để đẩy log lên.
> - **Ưu tiên mô hình Source-Initiated:** Các VPS nguồn chủ động kết nối đẩy log về Collector qua cổng `5985` (HTTP) hoặc `5986` (HTTPS), rất phù hợp cho môi trường Workgroup hoặc sau NAT.
> - **Kiểm tra thực tế:** Dùng `eventcreate` tạo một sự kiện giả lập trên máy nguồn và xác minh log xuất hiện trong mục *Forwarded Events* trên Collector.
> - *Cập nhật: 11/2026*

## 1. Cấu hình trên máy chủ Collector (Windows Event Collector)

Trên Windows VPS đóng vai trò máy chủ thu thập tập trung, mở PowerShell với quyền Administrator và bật dịch vụ WinRM cùng Windows Event Collector:

```powershell
winrm quickconfig -quiet
wecutil qc /q
```

Tạo tệp cấu hình subscription `rdp-security-sub.xml` để lắng nghe sự kiện đăng nhập thành công/thất bại (`4624`, `4625`) và thay đổi tài khoản (`4720`, `4732`) từ các VPS nguồn:

```xml
<Subscription xmlns="http://schemas.microsoft.com/2006/03/windows/events/subscription">
  <SubscriptionId>Sec-RDP-Events</SubscriptionId>
  <SubscriptionType>SourceInitiated</SubscriptionType>
  <Description>Thu thap Security Log tu cac Windows VPS</Description>
  <Enabled>true</Enabled>
  <Uri>http://schemas.microsoft.com/wbem/wsman/1/windows/EventLog</Uri>
  <ConfigurationMode>MinLatency</ConfigurationMode>
  <Delivery Mode="Push">
    <Batching><MaxLatencyTime>30000</MaxLatencyTime></Batching>
  </Delivery>
  <Query><![CDATA[
    <QueryList><Query Id="0" Path="Security">
      <Select Path="Security">*[System[(EventID=4624 or EventID=4625 or EventID=4720)]]</Select>
    </Query></QueryList>
  ]]></Query>
  <ReadExistingEvents>false</ReadExistingEvents>
  <TransportName>HTTP</TransportName>
  <LogFile>ForwardedEvents</LogFile>
  <AllowedSourceNonDomainComputers><AllowedIssuerCAList></AllowedSourceNonDomainComputers>
</Subscription>
```

Nạp subscription bằng lệnh:

```powershell
wecutil cs rdp-security-sub.xml
wecutil gs Sec-RDP-Events
```

## 2. Cấu hình trên VPS nguồn và kiểm tra hoạt động thực tế

Trên từng Windows VPS nguồn (nếu không nằm trong Active Directory Domain, dùng xác thực chứng chỉ HTTPS hoặc cấu hình WinRM TrustedHosts trong mạng Private VLAN), bật WinRM và trỏ địa chỉ Collector qua Local Group Policy (`gpedit.msc` -> *Computer Configuration > Administrative Templates > Windows Components > Event Forwarding > Configure target Subscription Manager*) với chuỗi:

`Server=http://<IP_COLLECTOR>:5985/wsman/SubscriptionManager/WEC,Refresh=60`

Đồng thời thêm tài khoản `NETWORK SERVICE` vào nhóm `Event Log Readers` trên máy nguồn để tiến trình WinRM có quyền đọc Security Log:

```powershell
net localgroup "Event Log Readers" "NT AUTHORITY\NETWORK SERVICE" /add
gpupdate /force
```

Kiểm tra thực tế bằng cách chạy `wecutil gr Sec-RDP-Events` trên máy Collector để thấy tên máy nguồn ở trạng thái `Active`. Bạn cũng có thể kết hợp với [Redsocks Transparent Redirect](https://thuecloud.vn/redsocks-transparent-redirect-cai-dat-chi-tiet-tu-dau-va-kiem-tra-hoat-dong-thuc-te) nếu cần định tuyến log qua tunnel an toàn, hoặc xem thêm [kinh nghiệm vận hành n8n Error Workflow Alert](https://thuecloud.vn/n8n-error-workflow-alert-kinh-nghiem-van-hanh-thuc-te-va-so-sanh-phuong-an-thay-the) và [phân tích lỗi n8n Error Workflow](https://thuecloud.vn/n8n-error-workflow-alert-phan-tich-loi-thuong-gap-va-quy-trinh-xu-ly-su-co-nhanh) để đẩy cảnh báo từ Collector ra Telegram.

## 3. Bảng tóm tắt các Event ID quan trọng cần Forward

| Event ID | Log Path | Ý nghĩa bảo mật cần giám sát |
| :--- | :--- | :--- |
| `4624` | Security | Đăng nhập thành công (kiểm tra `Logon Type 10` cho RDP từ xa) |
| `4625` | Security | Đăng nhập thất bại (phát hiện tấn công dò mật khẩu brute-force RDP) |
| `4720` / `4732` | Security | Tạo user mới hoặc thêm user vào nhóm Administrators |
| `1102` | Security | Nhật ký Security Log bị xóa (dấu hiệu xâm nhập cao nhất) |

Xem thêm [bảng giá Windows/Linux VPS](https://thuecloud.vn/pricing) và [mục câu hỏi thường gặp](https://thuecloud.vn/faq) để thiết kế cụm giám sát phù hợp.

> **Triển khai máy chủ Collector Windows ổn định tại ThueCloud.Vn**  
> Hạ tầng **KVM Enterprise NVMe** tại `vn-hn` hỗ trợ mạng nội bộ tốc độ cao giữa các VPS Windows giúp WEF truyền log tức thì, đi kèm **SLA 99,9%**, **VAT 0%** và **hoàn tiền 07 ngày**. Dễ dàng dựng Collector từ **VPS VN 2** (`78.000đ`/`90.000đ`) hoặc **VPS VN 3** (`139.000đ`/`170.000đ`).

## Câu hỏi thường gặp (FAQ)

### Dùng WEF qua cổng 5985 HTTP trong môi trường Workgroup có an toàn không?
Nếu các VPS nằm trên cùng mạng Private VLAN cô lập, cổng 5985 đủ dùng. Tuy nhiên, nếu truyền log qua Internet công cộng, bạn bắt buộc phải cấu hình WinRM qua HTTPS (cổng 5986) kèm chứng chỉ SSL để mã hóa toàn bộ dữ liệu log.

### Tại sao log `Application` và `System` đẩy về bình thường nhưng `Security` lại không thấy?
Do `Security` log có quyền đọc khắt khe hơn. Bạn phải chắc chắn đã thêm `NT AUTHORITY\NETWORK SERVICE` vào nhóm `Event Log Readers` trên máy nguồn và khởi động lại dịch vụ `Windows Event Log` (hoặc reboot nhẹ).

### File `ForwardedEvents.evtx` trên Collector phình to quá mức thì giới hạn thế nào?
Mở Event Viewer trên Collector -> chuột phải vào *Forwarded Events* -> *Properties* -> đặt *Maximum log size* (ví dụ 2048 MB) và chọn *Overwrite events as needed*.

## References / Sources

- https://learn.microsoft.com/en-us/windows/win32/wec/windows-event-collector
- https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/wecutil

---

## Navigation & Machine-Readable Endpoints

- [Site Summary (llms.txt)](https://thuecloud.vn/llms.txt)
- [Full Technical Reference (llms-full.txt)](https://thuecloud.vn/llms-full.txt)
- [Pricing Catalog (Markdown)](https://thuecloud.vn/pricing.md)
- [Blog & Technical Guides (Markdown)](https://thuecloud.vn/blog.md)
- [XML Sitemap](https://thuecloud.vn/sitemap.xml)
