KQL Basics Every SOC Analyst Should Know
Learn the core KQL syntax and query patterns SOC analysts use daily in Microsoft Sentinel and Defender to hunt threats faster.
Kusto Query Language (KQL) என்பது Microsoft Sentinel மற்றும் Microsoft Defender-இல் threat hunting மற்றும் alert triage-இன் அடிப்படையாகும். SOC-இல் பணிபுரிந்தால், KQL திறமை "இங்கே என்ன நடந்தது?" என்பதை விரைவாக பதிலளிக்கக்கூடிய analysts மற்றும் dashboard-ஐ கிளிக் செய்து நிற்பவர்களுக்கு இடையேயான வேறுபாடாகும். இது முழுமையான language reference அல்ல — தினமுமாக shift-இல் பயன்படுத்தப்படும் practical subset இது.
Why KQL Matters in the SOC
KQL read-only மற்றும் massive log datasets-ஐ வேகமாக query செய்வதற்கு optimized. Sentinel, Defender for Endpoint, Azure Monitor, மற்றும் Log Analytics அனைத்தும் KQL பேசும். ஒருமுறை இதை அறிந்தால், products-இடையே ஒரே mental model-ஆல் pivot செய்ய முடியும்: ஒரு table தேர்ந்தெடுக்கவும், அதை filter down செய்யவும், output ஐ shape செய்யவும். ஒவ்வொரு investigation — phishing triage, lateral movement hunts, false-positive tuning — query-ஆல் தொடங்கும்.
The Pipe Is Everything
KQL queries ஒரு pipeline-ஆக built. நீங்கள் ஒரு table-ஆல் தொடங்குகிறீர்கள் மற்றும் data-ஐ operators-இன் series வழியாக pass செய்கிறீர்கள், ஒவ்வொன்றும் முந்தைய result-ஐ filter, transform, அல்லது summarize செய்யும்:
SecurityEvent
| where EventID == 4625
| where TimeGenerated > ago(24h)
| summarize FailedLogons = count() by Account, Computer
| sort by FailedLogons desc
இதை top to bottom-க்கு ஒரு sentence-ஆக படிக்கவும்: SecurityEvent logs-ஆல் தொடங்குங்கள், failed logons (4625) மட்டுமே வைத்திருங்கள், last day-க்கு restrict செய்யவும், account/computer-க்கு failures-ஐ count செய்யவும், பின் sort செய்யவும். அந்த linear readability SQL-ஐ விட ad hoc hunting-க்கு KQL-இன் மிகப்பெரிய strength.
Core Operators to Memorize
- where — உங்களின் primary filter. data volume-ஐ expensive operations-க்கு முன் குறைக்க இதை ஆரம்பத்திலும் அடிக்கடியும் பயன்படுத்தவும்.
- project — specific columns-ஐ தேர்ந்தெடுத்து rename செய்யவும், output-இல் தேவையற்ற noise-ஐ discard செய்யவும்.
- extend — existing ones-ஐ drop செய்யாமல் computed columns-ஐ சேர்க்கவும், strings parse செய்வதற்கு அல்லது conditions-ஐ flag செய்வதற்கு useful.
- summarize —
count(),sum(),dcount(), அல்லதுmake_set()உடன் data-ஐ aggregate செய்யவும், almost alwaysbyஉடன் paired. - join — tables-இடையே correlate செய்யவும், e.g., sign-in logs-ஐ device inventory-உடன் link செய்து unmanaged device logons-ஐ spot செய்யவும்.
- render — results-ஐ timechart அல்லது barchart-ஆக visualize செய்யவும் query editor-இல் directly, spikes-ஐ spot செய்வதற்கு handy.
Time Filtering Done Right
Always TimeGenerated (அல்லது table-இன் equivalent timestamp column)-இல் filter செய்யவும் pipeline-இல் as early as possible. KQL engines time-range filters-ஐ மிகவும் optimize செய்கின்றன, மற்றும் | where TimeGenerated > ago(7d) -ஐ bottom-ற்கு பதிலாக top-க்கு near வைப்பது ஒரு query-க்கு விடையைத் திரும்பிக்கொடுக்க seconds vs ஒன்றை time out செய்வதற்கு இடையேயான difference ஆக இருக்கலாம் busy tenant-இல்.```kql SigninLogs | where TimeGenerated > ago(1h) | where ResultType != "0" | where UserPrincipalName has "@yourdomain.com"
## String Matching: has vs contains vs ==
ஒரு common mistake எல்லாவற்றிற்கும் `contains` default செய்வது. `has` whole terms-ஐ match செய்து ஒரு term index-ஐ பயன்படுத்துகிறது, large tables-இல் dramatically faster-ஐ செய்கிறது. `contains` -ஐ فقط ஒரு word-ற்குள் (like a partial domain fragment) substring matches-ஐ தேவைப்பட்டால் பயன்படுத்தவும், மற்றும் structured fields-இல் (like EventID அல்லது IPAddress) exact matches-ற்கு `==` பயன்படுத்தவும். இந்த ஒரு habit `DeviceNetworkEvents` அல்லது `CommonSecurityLog`-ஐ போன்ற high-volume tables-இல் hunts-ஐ noticeably speed up செய்கிறது.```kql
DeviceProcessEvents
| where ProcessCommandLine has "powershell"
| where ProcessCommandLine has_any ("-enc", "-EncodedCommand")
Building Reusable Detection Logic
ஒருமுறை ஒரு query useful prove செய்தால், அதை let உடன் ஒரு function-ஆக wrap செய்யவும், அல்லது அதை scheduled execution உடன் Sentinel Analytics Rule-ஆக save செய்யவும். Thresholds (like failed logon counts)-ஐ parameterize செய்யவும் அதே logic tenants-இல் scale ஆக அல்லது rewrite செய்யாமல் tune ஆக. இது ஒரு one-off hunting queries-ஐ எப்படி standing detections-ஆக evolve செய்கிறது automatic-ஆக page the SOC.
Common Pitfalls
TimeGeneratedfilters-ஐ forgetting, slow, expensive full-table scans-ஐ causing.summarize-ஐwhere-க்கு முன் பயன்படுத்துதல், which forces the engine to aggregate unfiltered data.- Tables-ஐ join செய்யும்போது mismatched column names — always schema-ஐ
getschemaஉடன் check செய்யவும் first. contains-ஐ overusing, which skips indexing benefits மற்றும் large-scale hunts-ஐ slows down.
KQL nested subqueries-ற்கு பதிலாக pipelines-இல் think செய்யும் analysts-ஐ reward செய்கிறது. ஒவ்வொரு investigation-ஐ ஒரு narrow time window மற்றும் ஒரு specific table-ஆல் தொடங்குங்கள், பின்னர் needed-ஆக மாத்திரம் widen செய்யவும்.
இது உங்களுக்கு ஒரு solid foundation கொடுத்திருந்தால், Korra Studio-இல் Blue Team மற்றும் Digital Forensics segments-ஐ explore செய்யவும் more hands-on SOC query walkthroughs மற்றும் detection-building exercises-ற்கு.
AI உதவியுடன் எழுதப்பட்டது, Michal Pilch (CISSP), Korra Studio ஆல் மறுஆய்வு செய்யப்பட்டு வெளியிடப்பட்டது.
இது Korra Studio அறிவுத் தளத்தில் இருந்து ஒரு குறிப்பு — மேடை ஒவ்வொரு தலைப்பையும் 1-க்கு-1 மாற்றுச் சொற்களுடன் இணைக்கிறது.
இலவசமாக தொடங்கவும்arrow_forward