For Sophos Central Live Discover and Data Lake
Sophos SQL cheat sheet
Sophos Live Discover uses osquery SQL. Ask online devices about their processes, ports, users and files right now, or search the Data Lake for what happened earlier.
Checked against Sophos documentation and osquery’s table definitions in November 2026.
Live Discover on devices
These run on the devices you pick, and only answer if the device is online.
| To do this | Write this |
|---|---|
| Running processes | |
| Exact match, case matters | |
Match, ignore caseLIKE ignores case for plain letters. | |
Contains text% is any text and _ is one character. | |
| One of several | |
| Process and its parent | |
| Listening ports and their process | |
| Local user accounts | |
| Startup items | |
| Enabled scheduled tasks (Windows) | |
| Services that start automatically (Windows) | |
| Files in a folder | |
Hash a filehash and file need a path or directory. | |
| Count and sort | |
| Pull text out with a regex | |
Ask for a value when the query runsA Live Discover variable. The name goes between $$ signs. | |
Data Lake
Data Lake rows come from queries Sophos runs on a schedule. Filter on query_name first. Set the time range in the console, up to 30 days per query.
| To do this | Write this |
|---|---|
| Windows processes | |
| One process, ignore case | |
| Started by a given parent | |
| Find a file hash | |
| Count by device | |
| See which data you have | |
Watch out for
=andINcompare exactly, so case matters. In Live Discover,LIKEignores case for plain letters. In the Data Lake, useLOWER()to be safe.- Live Discover only answers for devices that are online now. Use the Data Lake to look back.
- The
fileandhashtables need apathordirectoryin theWHERE, or they return nothing. - The Data Lake column is
cmdline, notcmd_lineorcommand_line. - In Live Discover, Windows paths need no escaping.
'C:\Windows\Temp'works as written. - A query must be at least 15 characters long before Live Discover will run it.
Official docs and cheat sheets
Sophos doesn’t publish an official cheat sheet. These are its official references, plus osquery’s table list, which Live Discover is built on.
- Live DiscoverSophos Central help for running Live Discover queries.(opens in a new tab)
- Edit or create a queryWriting your own queries, variables and Data Lake time ranges.(opens in a new tab)
- Sophos schema viewerThe Data Lake tables and columns, including
xdr_data.(opens in a new tab) - Getting started with XDR QuerySophos’s API guide, with a full Data Lake query and its columns.(opens in a new tab)
- osquery schemaEvery osquery table and column, by operating system.(opens in a new tab)
- osquery SQL introductionosquery’s SQL, including
regex_matchandsplit.(opens in a new tab)
Keep going
Practise these in real exercises
A cheat sheet tells you the syntax. SOC Fluent gives you exercises to solve with it, on realistic lab data, and shows you what your query missed. Join the waitlist and we’ll email you once, on launch day.
Free to join. Students get 50% off at launch.