Skip to content
SOC Analyst Prep
  • Loading index…

↑↓ navigate · ↵ open · Esc close

en

Module 05 / 05

SIEM, Splunk SPL and Sentinel KQL

Most SOC interviews include at least one 'write me a query' or 'how would you tune this' question. This module explains how a SIEM turns raw logs into alerts, then teaches the Splunk and Microsoft Sentinel query basics side by side using the same hunts, so you can answer whichever platform the interviewer uses.

Intermediate26 min read5 topicsUpdated 2026-11-23

Topic 1

How a SIEM Works

Concept

A SIEM (Security Information and Event Management) does four things. Ingest: collect logs from sources via agents (Splunk Universal Forwarder, Azure Monitor Agent), syslog, or APIs for cloud services. Parse and normalise: extract fields from raw text and map them to a common schema so src_ip from a firewall and IpAddress from Windows can be queried the same way (Splunk CIM, Sentinel ASIM). Correlate: run detection rules, which can be single-event matches, thresholds, or sequences across sources. Alert: create alerts or incidents with severity and context for analysts, and often trigger SOAR playbooks.

Time synchronisation matters because correlation is time-based. If a domain controller is three minutes off and the firewall is in a different time zone that was parsed wrongly, a 'failed logons followed by success within 5 minutes' rule can miss, and your incident timeline will be in the wrong order. Use NTP everywhere and store times in UTC.

Normalisation matters because a rule is only as good as the field it queries. If one source writes user=NORTHWIND\rkumar and another rkumar@northwind-logistics.com, a per-user correlation will treat them as two people. Parsing failures are a silent cause of missed detections.

  • Pipeline: collect, parse, normalise, store, correlate, alert (then respond, often via SOAR).
  • Normalisation schemas: Splunk CIM, Sentinel ASIM.
  • Time: NTP everywhere, UTC in storage, watch for time-zone parsing errors.
  • Log source health matters: a silent source is a blind spot, so alert on sources that stop sending.
  • A SIEM detects; SOAR automates response; EDR protects and investigates endpoints.

Real log example

Same logon, two raw formats, one normalised view
RAW (Windows XML-derived): EventID=4624 TargetUserName=rkumar TargetDomainName=NORTHWIND IpAddress=10.10.40.21 TimeCreated=2026-11-18T08:59:12.381Z
RAW (VPN syslog):          <134>Nov 18 14:29:10 vpn01 user rkumar@northwind-logistics.com authenticated from 198.51.100.40 assigned 10.10.40.21
NORMALISED:                time=2026-11-18T08:59:12Z action=success user=rkumar src_ip=10.10.40.21 app=windows dest=NW-WS114
NORMALISED:                time=2026-11-18T08:59:10Z action=success user=rkumar src_ip=198.51.100.40 app=vpn assigned_ip=10.10.40.21

The VPN logs in local time (IST, UTC+5:30) without a zone; parsed as UTC it would land 5.5 hours off. After correct parsing and user-name normalisation, the VPN logon and the Windows logon two seconds later line up as the same person.

Interview question

“How does a SIEM work, and why do time synchronisation and normalisation matter?”

What the interviewer is testing: Whether you understand the SIEM pipeline beyond "it collects logs", and the data-quality issues that break detections.

Weak answer

A SIEM collects logs from all devices and generates alerts when something suspicious happens.

Why it loses points: It skips parsing, normalisation and correlation, which is where most detection failures actually happen.

Strong answer sketch

A SIEM collects logs through agents, syslog and APIs, parses them into fields, normalises those fields to a common schema like Splunk CIM or Sentinel ASIM, stores them, and runs correlation rules that raise alerts. Correlation is time-window based, so if clocks drift or a source's time zone is parsed wrongly, a rule like 'brute force followed by success within 10 minutes' can miss entirely and timelines get scrambled. Normalisation matters because if the same user appears as a domain name in one source and a UPN in another, per-user rules split them. As an analyst, when a timeline looks wrong I check the raw timestamp and time zone before drawing conclusions, and I flag sources that stop sending.

Common mistakes

  • Describing a SIEM only as log storage.
  • Never checking raw timestamps when a timeline looks odd.
  • Not realising a missing or misparsed log source produces no alert at all, not a false alert.

Topic 2

Splunk SPL Fundamentals

Concept

A Splunk search starts by narrowing data with index (where data is stored), sourcetype (the data format), host, source and a time range, then pipes results through commands. Always filter as early as possible: index=wineventlog EventCode=4625 before the first pipe is far cheaper than filtering later.

Core commands: stats count by field (aggregate), where (filter on computed values or comparisons), table (choose columns), sort -count (sort descending), timechart span=5m count by field (counts over time), rare / top (least/most common values), eval (create fields), dedup, and rex (regex field extraction). stats functions such as dc() (distinct count), values(), min(_time), max(_time) do most of the work in triage.

Field names depend on the add-on. With the Splunk Add-on for Microsoft Windows, a 4625 event typically exposes CIM-style fields such as user, src_ip, dest and Logon_Type, alongside the original names. In an interview, say that you would confirm field names with a quick | fieldsummary or by looking at a raw event.

  • Filter early: index=, sourcetype=, EventCode=, time range.
  • stats count dc(user) values(user) by src_ip is the workhorse of triage.
  • where count > 20 filters on aggregated results; search filters on raw fields.
  • timechart for spikes, rare for outliers, table for readable output.
  • Field names vary by add-on; check them before relying on them.

Real log example

SPL: brute force followed by success from the same source
index=wineventlog (EventCode=4625 OR EventCode=4624) earliest=-24h
| eval outcome=if(EventCode=4625, "failure", "success")
| stats count(eval(outcome="failure")) AS failures
        count(eval(outcome="success")) AS successes
        dc(user) AS distinct_users
        values(user) AS users
        min(_time) AS first_seen max(_time) AS last_seen
        by src_ip
| where failures > 20 AND successes > 0
| eval first_seen=strftime(first_seen, "%F %T"), last_seen=strftime(last_seen, "%F %T")
| sort - failures

One row per source IP with both failures and successes. A high distinct_users count suggests password spraying; one user with many failures suggests guessing. Add | timechart span=5m count by src_ip on the raw 4625s to see the burst shape.

Interview question

“Write a Splunk query to detect brute-force attempts against Windows hosts.”

What the interviewer is testing: Whether you can produce working SPL with sensible filtering, aggregation and thresholds, and explain it.

Weak answer

search failed login | count | if count > 10 then alert

Why it loses points: That is not valid SPL and shows no knowledge of indexes, EventCodes or stats.

Strong answer sketch

I would start with index=wineventlog EventCode=4625 over the last hour, then stats count, dc(user) and values(user) by src_ip and dest, and add where count > 20 to keep only noisy sources. A high distinct user count points to password spraying, while one user with many failures is guessing. The more valuable version also pulls in 4624 and keeps only sources that have failures and at least one success, because that is a possible compromise rather than noise. Before trusting it I would check the field names in our add-on and exclude known sources like our vulnerability scanner.

Common mistakes

  • Starting a search without index or sourcetype, which is slow and expensive.
  • Confusing where with search after a stats.
  • Alerting on failures alone and never correlating with a success.

Topic 3

Microsoft Sentinel KQL Fundamentals

Concept

KQL (Kusto Query Language) queries start from a table and pipe through operators. The tables you will meet first: SecurityEvent (Windows Security events from agents, with columns like EventID, Account, TargetAccount, IpAddress, LogonType, Computer), SigninLogs (Entra ID interactive sign-ins with UserPrincipalName, IPAddress, ResultType, Location, LocationDetails, DeviceDetail, AppDisplayName, UserAgent), plus AuditLogs, OfficeActivity, DeviceProcessEvents and CommonSecurityLog (CEF firewall logs).

Core operators: where (filter), summarize (aggregate, like SPL stats), project (choose and rename columns, like table), extend (add a computed column, like eval), bin() (time buckets inside summarize), sort by / top, join, and render timechart. Time filters use TimeGenerated > ago(1h); put them first for performance.

In SigninLogs, ResultType is a string: "0" is success, and failure codes such as "50126" (invalid username or password), "50053" (account locked or sign-in blocked), and "50074" (strong authentication required) tell you why. Dynamic columns are accessed with dot notation, for example tostring(LocationDetails.city) and tostring(DeviceDetail.deviceId).

  • Pattern: Table | where TimeGenerated > ago(1h) | where ... | summarize ... by ... | project ....
  • SPL to KQL: stats = summarize, table = project, eval = extend, timechart = summarize ... by bin(TimeGenerated, 5m) | render timechart.
  • SecurityEvent for Windows events; SigninLogs for Entra ID sign-ins.
  • SigninLogs.ResultType is a string: "0" success, "50126" bad credentials.
  • Use tostring() on dynamic fields like LocationDetails and DeviceDetail.

Real log example

KQL: the same brute-force hunt on SecurityEvent and SigninLogs
// Windows: failures then success from the same source
SecurityEvent
| where TimeGenerated > ago(24h)
| where EventID in (4625, 4624)
| summarize Failures = countif(EventID == 4625),
            Successes = countif(EventID == 4624),
            DistinctUsers = dcount(TargetAccount),
            Users = make_set(TargetAccount, 20),
            FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated)
    by IpAddress, Computer
| where Failures > 20 and Successes > 0
| sort by Failures desc

// Entra ID: password spray in 10-minute buckets
SigninLogs
| where TimeGenerated > ago(24h)
| where ResultType == "50126"
| summarize Attempts = count(), Users = dcount(UserPrincipalName) by IPAddress, bin(TimeGenerated, 10m)
| where Users > 10
| project TimeGenerated, IPAddress, Attempts, Users

countif() replaces SPL's count(eval()). The SigninLogs query flags one IP failing against many different users in a 10-minute bucket, the spray pattern. Note ResultType is compared as a string.

Interview question

“How would you hunt for a password spray in Microsoft Sentinel?”

What the interviewer is testing: KQL fluency with the right table and columns, and understanding spray vs brute force.

Weak answer

I would search the logs for failed logins and see if there are many.

Why it loses points: No table, no columns, and no distinction between spray (many users) and brute force (one user).

Strong answer sketch

For cloud accounts I would query SigninLogs where ResultType is "50126", invalid username or password, over the last day. Then summarize the count and dcount of UserPrincipalName by IPAddress and bin(TimeGenerated, 10m). A spray shows one IP, or a small set, hitting many different users with few attempts each, which avoids lockouts, while brute force is many attempts on one user. I would then check whether any of those users had a ResultType "0" success from the same IPs, and look at UserAgent and AppDisplayName, since legacy protocols are often used in sprays because they bypass MFA.

Common mistakes

  • Comparing ResultType to a number instead of a string.
  • Mixing up spray (many users, few attempts) and brute force (one user, many attempts).
  • Forgetting tostring() when summarising dynamic fields like LocationDetails.

Topic 4

Impossible Travel and Sign-in Analytics

Concept

An impossible travel alert fires when the same account signs in from two locations that are too far apart for the time between them, for example Mumbai and Frankfurt 20 minutes apart. It is one of the most common identity alerts and one of the most common false positives, because IP geolocation reflects where the traffic exits to the internet, not where the person is.

Common benign causes: corporate VPN or zero-trust egress in another country, mobile carrier IPs geolocating to a hub city, cloud proxies, and a user's phone and laptop using different networks. Common malicious causes: credentials stolen by phishing and used from attacker infrastructure, or a session token replayed by an adversary-in-the-middle phishing kit.

Validate with evidence, not intuition. Is either IP a known corporate VPN egress? Does DeviceDetail.deviceId match a known, compliant device, or is it blank? Was MFA satisfied, and how (AuthenticationRequirement, MfaDetail/AuthenticationDetails)? Is the UserAgent and OS consistent with the user's usual one? Did the suspicious sign-in lead to anything, such as new inbox rules, MFA method registration or mass file downloads? And finally, ask the user through a trusted channel.

  • Geolocation shows the internet egress point, not the person.
  • Check: known VPN/proxy egress, DeviceDetail (deviceId, isCompliant, OS, browser), MFA result, UserAgent, app accessed.
  • Unknown device + new country + legacy auth or token reuse = escalate.
  • Look at post-sign-in activity: inbox rules, MFA registration, OAuth consents, downloads.
  • If malicious: revoke sessions, reset password, review MFA methods, block IP via Conditional Access.

Real log example

KQL: two countries within an hour for the same user
SigninLogs
| where TimeGenerated > ago(1d) and ResultType == "0"
| extend Country = tostring(LocationDetails.countryOrRegion),
         City = tostring(LocationDetails.city),
         DeviceId = tostring(DeviceDetail.deviceId),
         Browser = tostring(DeviceDetail.browser),
         OS = tostring(DeviceDetail.operatingSystem)
| summarize Countries = make_set(Country), Cities = make_set(City), IPs = make_set(IPAddress),
            Devices = make_set(DeviceId), UserAgents = make_set(UserAgent), Auth = make_set(AuthenticationRequirement)
    by UserPrincipalName, bin(TimeGenerated, 1h)
| where array_length(Countries) > 1

If one of the IPs is the company VPN egress and the deviceId is the same known laptop, it is likely benign. A blank deviceId, a new user agent and singleFactorAuthentication from the second country point the other way.

Interview question

“You get an impossible travel alert for a user: Bengaluru then Amsterdam 30 minutes later. How do you investigate?”

What the interviewer is testing: Whether you validate with concrete sign-in attributes instead of closing on assumption or escalating blindly.

Weak answer

It is impossible to travel that fast, so the account is hacked. I would disable the account.

Why it loses points: It ignores VPN and proxy egress, the most common cause, and takes disruptive action without evidence.

Strong answer sketch

First I check whether either IP is a known corporate VPN or proxy egress, since geolocation only shows where traffic leaves to the internet. Then I compare the two sign-ins in SigninLogs: DeviceDetail deviceId and compliance, operating system and browser, UserAgent, the app accessed, and whether MFA was satisfied. If the Amsterdam sign-in has a known compliant device and MFA, it is probably our VPN, and I note that as benign with the evidence. If it is an unknown device with a different user agent, or a token-only sign-in, I check for post-login activity like new inbox rules or MFA registrations, revoke sessions, reset credentials and escalate. I would also confirm with the user through a trusted channel, not by replying to an email.

Common mistakes

  • Treating IP geolocation as the user's physical location.
  • Closing as benign because "the user travels a lot" without checking device and MFA.
  • Only resetting the password when a session token may have been stolen.

Topic 5

Writing Good Detections and Reducing False Positives

Concept

A good detection has a clear purpose (the behaviour it catches, ideally mapped to ATT&CK), the right data source, logic that matches the behaviour rather than a single IOC, a threshold or time window that fits the environment, and enough context in the alert for an analyst to triage quickly. It should also come with a short playbook: what to check and what makes it a TP.

False positives are tuned, not ignored. First find out why the rule fires on benign activity: a vulnerability scanner, a backup job, a service account with an expired password retrying every minute. Then make the narrowest change that removes the noise: exclude a specific source IP and account combination rather than an entire subnet, raise a threshold based on observed baselines, or require an additional condition (failures and a success).

Allowlists should be documented and expire. Record who approved it, why, and a review date, because exceptions outlive the reason they were created, and attackers love trusted paths. A scanner IP excluded forever is a perfect place for an attacker to hide if that box is compromised. Track tuning in a change log so the team knows what the rule no longer sees.

  • Define the behaviour, data source, logic, threshold, ATT&CK mapping and triage steps.
  • Prefer behaviour (e.g. Office spawning PowerShell) over single IOCs.
  • Tune narrowly: specific host + account + process, not whole subnets or broad wildcards.
  • Allowlists need an owner, a reason and an expiry/review date.
  • Measure: track FP rate per rule and review noisy rules regularly.

Real log example

SPL: tuned brute-force rule with a time-bound allowlist
index=wineventlog EventCode=4625 earliest=-15m
| lookup bruteforce_allowlist src_ip OUTPUT reason expires
| where isnull(reason) OR strptime(expires, "%Y-%m-%d") < now()
| stats count dc(user) AS users values(user) AS user_list by src_ip, dest
| where count >= 25 OR users >= 10

Exceptions live in a lookup (columns src_ip, reason, expires; e.g. the Nessus scanner with its change ticket and a review date), and an expired entry stops suppressing automatically. The rule catches both guessing (count) and spraying (distinct users).

Interview question

“A detection rule is generating hundreds of false positives a day. What would you do?”

What the interviewer is testing: Whether you tune with analysis and discipline rather than disabling rules or adding broad exclusions.

Weak answer

I would disable the rule because it is creating too much noise and wasting the team's time.

Why it loses points: Disabling removes coverage entirely and does not identify the cause of the noise.

Strong answer sketch

I would not disable it. First I would pull a sample of the false positives and group them to see what is actually triggering it, for example one service account, a scanner, or a scheduled job. Then I would make the narrowest change that fixes it: exclude that specific account and host combination, adjust the threshold based on the baseline, or add a condition such as requiring a success after the failures. Any exclusion goes into a documented allowlist with an owner, reason and expiry date so it gets reviewed. Then I would monitor the rule for a week to confirm the FP rate dropped and it still fires on a test case.

Common mistakes

  • Disabling noisy rules instead of tuning them.
  • Excluding whole subnets or service accounts permanently.
  • Tuning without testing that the rule still catches the real attack.
  • Writing rules on single IOCs that attackers change daily.

More interview questions on this topic

Practise answers out loud in the drill

Knowledge check · SIEM, Splunk SPL and Sentinel KQL

0 / 5 answered
  1. 1.In Splunk, every firewall event appears exactly twice with identical timestamps and fields, doubling your brute-force alert counts. What is the most likely cause?
  2. 2.Which SPL search lists source IPs with more than 20 failed Windows logons?
  3. 3.In Microsoft Sentinel, which KQL counts failed Entra ID sign-ins per user over the last day?
  4. 4.A user signs in from London at 09:00 and from Singapore at 09:20. What should you check before escalating as account compromise?
  5. 5.A detection fires 300 times a day, almost all on scheduled logons by a backup service account from its known backup server. What is the best tuning?

Finished this module?

Mark it complete to update your progress (saved in this browser only), then prove it in the simulator.

Frequently asked questions

What is the difference between Splunk SPL and KQL?

Both are pipe-based query languages. SPL starts from index and sourcetype filters and uses commands like stats, eval and table; KQL starts from a table like SecurityEvent or SigninLogs and uses operators like summarize, extend and project. The logic of most hunts translates directly between them.

How do you detect brute force in Splunk?

Search index=wineventlog EventCode=4625, then use stats count and dc(user) by src_ip with a where clause on the count. A stronger version also includes 4624 and keeps only sources with many failures followed by at least one success.

What does ResultType 50126 mean in SigninLogs?

ResultType 50126 means invalid username or password in Microsoft Entra ID sign-in logs. ResultType "0" means success. Note that ResultType is stored as a string, so compare it with quotes in KQL.

How do you investigate an impossible travel alert?

Check whether either IP is a known VPN or proxy egress, then compare the two sign-ins: device ID and compliance, browser and OS, user agent, application and MFA result. Review post-sign-in activity such as inbox rules or MFA registration, and confirm with the user through a trusted channel.

How do you reduce false positives in a SIEM?

Identify why the rule fires on benign activity, then make the narrowest change: exclude a specific host and account pair, adjust thresholds from a baseline, or add conditions. Keep exceptions in a documented allowlist with an owner and expiry date, and retest the rule afterwards.

Why is time synchronisation important in a SIEM?

Correlation rules and investigation timelines depend on accurate timestamps. Clock drift or a wrongly parsed time zone can make a rule miss a sequence such as failures followed by a success, or put events in the wrong order.