For Sophos Central Live Discover and Data Lake
Practise and learn Sophos SQL
Sophos Central uses SQL to search your devices and the Data Lake. Practise it with exercises written like the tickets you get on shift, on realistic lab data, and see straight away whether your query found the right rows.
SOPHOS · SQL
SELECT meta_hostname, username, cmdline
FROM xdr_data
WHERE query_name = 'running_processes_windows_sophos'
AND LOWER(parent_name) = 'outlook.exe'
AND LOWER(name) IN ('powershell.exe', 'cmd.exe')
Questions you’ll answer
Every exercise starts as a ticket. You write the query that answers it.
SELECT pid, name, cmdline
FROM processes
WHERE LOWER(name) = 'cmd.exe'
SELECT meta_hostname, COUNT(*) AS runs
FROM xdr_data
WHERE query_name = 'running_processes_windows_sophos'
AND LOWER(name) = 'powershell.exe'
GROUP BY meta_hostname
ORDER BY runs DESC
Where you’ll use it
- Live DiscoverAsks devices that are online right now.
- Data LakeLooks back over up to 30 days of activity.
What you’ll learn, from beginner to advanced
Twelve modules in three levels. Each one has a short lesson, questions to answer and then exercises.
Beginner
- Your first query
SELECT,FROMandWHEREon the processes table. - Matching text
LIKE,LOWER()and when case matters. - Sorting and limiting
ORDER BY,LIMITandDISTINCT. - Counting
COUNT()andGROUP BY.
Intermediate
- Live Discover or Data LakeAsk online devices now, or look back up to 30 days.
- Data Lake queries
xdr_data,query_nameand choosing the time period. - Joining tables
JOINprocesses to users, files and network connections. - Real investigationsProcess trees, scheduled tasks and startup items.
Advanced
- Readable queries
WITH,CASEand subqueries. - Variables
$$Variable$$values, so one query works for any device or path. - Hunting across the estate
HAVINGand rare values to spot the odd device out. - Fast queriesA short time period, fewer columns, and a path for heavy tables like
file.
Worth knowing before you start
- Live Discover only reaches devices that are online. Data Lake looks back up to 30 days.
- Text matches in Data Lake are case-sensitive, so wrap names in
LOWER(). - The tables come from osquery, so what you learn here carries over to osquery anywhere.
Cheat sheet
Other languages
Be first in when it launches
Sophos SQL is one of the languages SOC Fluent launches with. Join the waitlist and we’ll email you once, on launch day.
Free to join. Students get 50% off at launch.