Skip to content
SOC FluentSpeak SIEM and EDR

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.

Is cmd.exe running on this laptop right now?
LIVE DISCOVER
SELECT pid, name, cmdline
FROM processes
WHERE LOWER(name) = 'cmd.exe'
Which devices ran PowerShell this week?
DATA LAKE
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

  1. Your first querySELECT, FROM and WHERE on the processes table.
  2. Matching textLIKE, LOWER() and when case matters.
  3. Sorting and limitingORDER BY, LIMIT and DISTINCT.
  4. CountingCOUNT() and GROUP BY.

Intermediate

  1. Live Discover or Data LakeAsk online devices now, or look back up to 30 days.
  2. Data Lake queriesxdr_data, query_name and choosing the time period.
  3. Joining tablesJOIN processes to users, files and network connections.
  4. Real investigationsProcess trees, scheduled tasks and startup items.

Advanced

  1. Readable queriesWITH, CASE and subqueries.
  2. Variables$$Variable$$ values, so one query works for any device or path.
  3. Hunting across the estateHAVING and rare values to spot the odd device out.
  4. 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.