Cheat sheet

SIEM queries

KQL for Elastic/Kibana, SPL for Splunk. The triage process is in SOC and SIEM.

CJCADefence

KQL and SPL side by side

I want…KQL (Kibana)SPL (Splunk)
Equalityevent.code:4625EventCode=4625
Several valuesevent.code:(4624 or 4625)EventCode IN (4624, 4625)
Excludenot user.name:"svc_backup"NOT user="svc_backup"
Wildcardprocess.name:*powershell*process_name="*powershell*"
Field existsprocess.command_line:*process_command_line=*
Rangedestination.port >= 1024dest_port>=1024
Networksource.ip:10.0.0.0/8| where cidrmatch("10.0.0.0/8", src_ip)
Count by fieldVisualisation (not in KQL)| stats count by user
ThresholdThreshold rule in Elastic Security| stats count by src_ip | where count > 10
Sort, limitColumn sort in Discover| sort -count | head 10
PitfallSPL field names depend on how the data was indexed. Check them in the fields sidebar before writing the query.

Common ECS fields (Elastic)

FieldContent
@timestampEvent date
event.codeEvent identifier (e.g. Windows Event ID)
event.action / event.outcomeAction performed / success or failure
host.nameMachine that produced the event
user.nameAccount involved
process.name / process.command_lineProcess and its command line
process.parent.nameParent process
source.ip / destination.ipSource and destination addresses
destination.portDestination port
file.path / file.hash.sha256File involved and its hash
winlog.event_data.LogonTypeWindows logon type

Ready-to-use queries (KQL)

# Failed logons on one account
event.code:4625 and user.name:"administrator"
# Successful RDP logons
event.code:4624 and winlog.event_data.LogonType:10
# PowerShell launched by an Office document
process.name:"powershell.exe" and process.parent.name:("winword.exe" or "excel.exe")
# Encoded PowerShell
process.name:"powershell.exe" and process.command_line:*-enc*
# Access to lsass (Sysmon)
event.code:10 and winlog.event_data.TargetImage:*lsass.exe
# Audit log cleared
event.code:1102

Ready-to-use queries (SPL)

# Sources with many failed logons
index=windows EventCode=4625
| stats count by src_ip, user
| where count > 10 | sort -count
# Rare processes across the estate
index=sysmon EventCode=1
| stats count by Image | sort count | head 20