בתשתית עם 50+ שרתי Windows, ניתוח לוגים ידני הוא בזבוז זמן. ללא ריכוזיות, זמן הגילוי הממוצע (MTTD) של תקרית בשרתי Windows גבוה פי 2–3 מאשר ב-Linux. על ידי הגדרת WEF ל-200+ שרתים בדומיין, הפחתנו את MTTD מ-48 שעות ל-15 דקות—שיפור של פי 8. זה מקצר את זמן התגובה לתקריות ומגביר את יעילות הביקורת של Windows Server. העברת לוגים של אירועים (WEF) היא מנגנון Windows מובנה המבוסס על תיעוד Microsoft על WinRM, המאפשר איסוף אירועים ללא סוכן צד שלישי.
Windows Event Forwarding (WEF): גישה מקורית
WEF הוא מנגנון המבוסס על WinRM. ארכיטקטורה: Windows Event Collector (WEC)—שרת מאגד שמנווט למקורות (Collector Initiated) או ממתין לדחיפה מהמקורות (Source Initiated). עבור סביבת דומיין, Source Initiated דרך GPO היא האפשרות המועדפת: אין צורך בהרשאות על כל מקור בנפרד, וניתן להרחיב לאלפי צמתים. מאגד טיפוסי יכול לעבד עד 5000 אירועים בשנייה.
| פרמטר | Source Initiated | Collector Initiated |
|---|---|---|
| פריסה | דרך GPO (המוני) | ידנית על כל שרת |
| הרשאות נדרשות | רק על המאגד | על כל מקור |
| מדרגיות | קלה, עד 1000+ צמתים | קשה, עד 100 צמתים |
| הצפנה | HTTPS (תלוי ב-WinRM) | HTTPS |
טעות נפוצה היא לשכוח להגדיר HTTPS עבור WinRM, מה שמותיר את התעבורה לא מוצפנת. או לא לסנן EventIDs, מה שסותם את הערוץ במיליוני אירועים מיותרים.
איך להגדיר WEF דרך GPO?
ההגדרה כוללת שלושה שלבים:
- הגדרת WinRM על המאגד והמקורות דרך GPO.
- יצירת מינוי (subscription) על המאגד עם ציון EventIDs היעד.
- הקצאת הרשאות ואימות קישוריות.
הגדרת WinRM על המאגד והמקורות
# На коллекторе
winrm quickconfig -q
wecutil qc -q
# На каждом источнике (через GPO или локально)
winrm quickconfig -q
Set-Item WSMan:\localhost\Client\TrustedHosts -Value "collector.domain.com" יצירת מינוי על המאגד
תבנית מינוי XML לאיסוף אירועי אבטחה, מערכת ויישומים:
<Subscription xmlns="http://schemas.microsoft.com/2006/03/windows/events/subscription">
<SubscriptionId>SecurityEvents</SubscriptionId>
<SubscriptionType>SourceInitiated</SubscriptionType>
<Description>Security events from all domain servers</Description>
<Enabled>true</Enabled>
<Uri>http://schemas.microsoft.com/wbem/wsman/1/windows/EventLog</Uri>
<ConfigurationMode>MinLatency</ConfigurationMode>
<Delivery Mode="Push">
<Batching>
<MaxItems>100</MaxItems>
<MaxLatencyTime>1000</MaxLatencyTime>
</Batching>
<PushSettings>
<Heartbeat Interval="900000"/>
</PushSettings>
</Delivery>
<Query>
<![CDATA[
<QueryList>
<Query Id="0">
<Select Path="Security"> *[System[(EventID=4624 or EventID=4625 or EventID=4634 or EventID=4648 or EventID=4720 or EventID=4722 or EventID=4724 or EventID=4728 or EventID=4732 or EventID=4756 or EventID=4767 or EventID=4771 or EventID=4776)]] </Select>
<Select Path="System"> *[System[Level<=3]] </Select>
<Select Path="Application"> *[System[Level=1 or Level=2]] </Select>
</Query>
</QueryList>
]]>
</Query>
<ReadExistingEvents>false</ReadExistingEvents>
<TransportName>HTTP</TransportName>
<ContentFormat>RenderedText</ContentFormat>
<Locale Language="en-US"/>
<LogFile>ForwardedEvents</LogFile>
<AllowedSourceDomainComputers>O:NSG:NSD:(A;;GA;;;DC)(A;;GA;;;NS)</AllowedSourceDomainComputers>
</Subscription>שמור את הקובץ בשם # На коллекторе winrm quickconfig -q wecutil qc -q # На каждом источнике (через GPO или локально) winrm quickconfig -q Set-Item WSMan:\localhost\Client\TrustedHosts -Value "collector.domain.com" והרץ על המאגד: <Subscription xmlns="http://schemas.microsoft.com/2006/03/windows/events/subscription"> <SubscriptionId>SecurityEvents</SubscriptionId> <SubscriptionType>SourceInitiated</SubscriptionType> <Description>Security events from all domain servers</Description> <Enabled>true</Enabled> <Uri>http://schemas.microsoft.com/wbem/wsman/1/windows/EventLog</Uri> <ConfigurationMode>MinLatency</ConfigurationMode> <Delivery Mode="Push"> <Batching> <MaxItems>100</MaxItems> <MaxLatencyTime>1000</MaxLatencyTime> </Batching> <PushSettings> <Heartbeat Interval="900000"/> </PushSettings> </Delivery> <Query> <![CDATA[ <QueryList> <Query Id="0"> <Select Path="Security"> *[System[(EventID=4624 or EventID=4625 or EventID=4634 or EventID=4648 or EventID=4720 or EventID=4722 or EventID=4724 or EventID=4728 or EventID=4732 or EventID=4756 or EventID=4767 or EventID=4771 or EventID=4776)]] </Select> <Select Path="System"> *[System[Level<=3]] </Select> <Select Path="Application"> *[System[Level=1 or Level=2]] </Select> </Query> </QueryList> ]]> </Query> <ReadExistingEvents>false</ReadExistingEvents> <TransportName>HTTP</TransportName> <ContentFormat>RenderedText</ContentFormat> <Locale Language="en-US"/> <LogFile>ForwardedEvents</LogFile> <AllowedSourceDomainComputers>O:NSG:NSD:(A;;GA;;;DC)(A;;GA;;;NS)</AllowedSourceDomainComputers> </Subscription> . EventIDs מרכזיים: 4624 (התחברות מוצלחת), 4625 (התחברות נכשלה), 4720 (יצירת משתמש), 4724 (איפוס סיסמה), 4728/4732/4756 (הוספה לקבוצות מועדפות).
Winlogbeat: שליחה ל-Elasticsearch
Winlogbeat הוא האנלוג ל-Filebeat עבור Windows Event Log, חלק מ-Elastic Stack. היתרון שלו הוא סינון ועיבוד מובנים, החיסרון הוא תלות ב-Elasticsearch.
למה לשלב WEF ו-Winlogbeat?
WEF מאגד לוגים למאגד, ו-Winlogbeat שולח אותם ל-Elasticsearch. גישה זו מפחיתה את העומס על כל מקור פי 2 בהשוואה להתקנת Winlogbeat על כל שרת. בנוסף, סינון במאגד מפחית את נפח הנתונים המועברים ב-60–80%. להלן הגדרת Winlogbeat עבור ForwardedEvents:
# winlogbeat.yml
winlogbeat.event_logs:
- name: Application
ignore_older: 72h
level: critical, error, warning
- name: System
ignore_older: 72h
level: critical, error, warning
- name: Security
ignore_older: 72h
event_id: 4624, 4625, 4634, 4648, 4720, 4722, 4724, 4728, 4732, 4756, 4767, 4771, 4776, 7045
- name: ForwardedEvents
ignore_older: 72h
- name: Microsoft-Windows-PowerShell/Operational
ignore_older: 72h
processors:
- add_host_metadata:
when.not.contains.tags: forwarded
output.elasticsearch:
hosts: ["elasticsearch.monitoring.svc:9200"]
index: "winlogbeat-%{[agent.version]}-%{+yyyy.MM.dd}"
ssl.certificate_authorities: ["C:/certs/ca.crt"]
ssl.certificate: "C:/certs/winlogbeat.crt"
ssl.key: "C:/certs/winlogbeat.key"
setup.template.settings:
index.number_of_shards: 1
index.number_of_replicas: 0
התקנה דרך PowerShell:
$url = "https://artifacts.elastic.co/downloads/beats/winlogbeat/winlogbeat-latest-windows-x86_64.zip"
Invoke-WebRequest -Uri $url -OutFile "winlogbeat.zip"
Expand-Archive -Path "winlogbeat.zip" -DestinationPath "C:\Program Files\winlogbeat"
cd "C:\Program Files\winlogbeat\winlogbeat-latest-windows-x86_64"
.\install-service-winlogbeat.ps1
Start-Service winlogbeat NXLog: סוכן אוניברסלי
NXLog Community Edition עובד גם עם WEF וגם עם שליחה ל-Syslog, Loki, או כל נקודת קצה אחרת. שימושי כאשר Elasticsearch אינו חלק מהערימה.
| פרמטר | Winlogbeat | NXLog |
|---|---|---|
| אינטגרציית Elastic | טבעית | דרך תוספים |
| פלט Loki | נדרש תוסף | מובנה (om_http) |
| משאבים | ~50 MB RAM | ~20 MB RAM |
| גמישות סינון | X-Path | ביטויים רגולריים |
דוגמת הגדרת NXLog לשליחה ל-Loki:
<Input eventlog>
Module im_msvistalog
Query <QueryList><Query Id="0"><Select Path="Security">*[System[(Level<=3) or (EventID=4624 or EventID=4625)]]</Select></Query></QueryList>
SavePos TRUE
ReadFromLast TRUE
</Input>
<Output loki>
Module om_http
URL http://loki.monitoring:3100/loki/api/v1/push
ContentType application/json
<Exec>
$Message = to_json();
</Exec>
</Output>
<Route r1>
Path eventlog => loki
</Route> טעויות נפוצות בהגדרת WEF
- HTTPS לא מוגדר עבור WinRM—התעבורה לא מוצפנת.
- מינוי רחב מדי—לוכד את כל האירועים, מעמיס על הרשת והמאגד.
- TrustedHosts לא מוגדר על המקורות—החיבור נדחה.
- משך חיי מינוי לא מוגדר—המינוי עלול להיתקע.
מה כלול בעבודה—תוצרים
- עיצוב ארכיטקטורה לאיסוף לוגים (בחירת גישה, הגדרת WinRM ו-GPO)
- יצירת מינויי WEF עבור EventIDs שלך (אבטחה, יישומים, מערכת)
- התקנה והגדרה של Winlogbeat/NXLog על המאגד
- אינטגרציה עם SIEM (Elastic, Loki, Splunk)—הגדרת אינדקסים והתראות
- תיעוד: דיאגרמת זרימה, runbook להרחבה, רשימת אירועים מסוננים
- הדרכת צוות (סדנה של שעתיים)
- אחריות על ההגדרה—30 ימי תמיכה חינם
הגדרת העברת לוגים של אירועים אורכת 1–3 ימים תלוי בגודל הדומיין ודרישות הסינון. צור קשר כדי להעריך את התשתית שלך תוך יום אחד. למהנדסים שלנו יש הסמכות Microsoft וניסיון של 5+ שנים בבניית מערכות ניטור לסביבות Windows. הזמן את ההגדרה—קבל ייעוץ.







