Linux Format

Using Osquery to explore your system

f0090-04.jpg

Put simply, Osquery is software that enables you to run SQL queries to provide information about your system. With Osquery, SQL tables represent abstract concepts such as running processes, loaded kernel modules, open network connections, browser plugins, hardware events or file hashes.

The idea is that rather than running lots of different utilities to find out things about your system, you instead run an SQL query on one of the tables. Behind the scenes, Osquery has mapped the state of your system into lots of different tables.

How many tables? Well https://osquery.io/schema/5.12.1/ lets you select your OS type (Linux, Mac and Windows) and shows a clickable list. For Linux, there are 154 tables. A significant proportion of these are tied into software you have installed, so there are tables for Chrome, Firefox, Docker, npm packages and quite a few more.

Just click on a table name in the list to see all the fields. When you want to inspect a concept, you ‘select’ the data, and the associated OS APIs are called in real time.

Ironically, the query select * from cpu_info; returns nothing on our system because it’s running in a virtual machine, although cpuid does. Other queries, such as select * from deb_packages;, return many rows. In that case, you might find select count(*)

You’re reading a preview, subscribe to read more.

More from Linux Format

Linux Format2 min read
Nuphy Halo75 V2
The mechanical keyboard hobby can be very expensive – but it doesn’t have to be. The Nuphy Halo75 V2 is a wireless pre-built mechanical keyboard with a 75% layout that offers a fantastic, enthusiast-level typing experience out of the box – and it ret
Linux Format2 min read
Is Valve Starting An OS War With Microsoft?
THIS ISSUE: Valve to open up? » Shiny new Chrome » Torvalds’s tirade » Future Flathub fees » Mozilla makeover Valve’s recent update to its branding guidelines has sparked online speculation about whether the company plans to release SteamOS 3 on othe
Linux Format1 min read
Electric Themes
Jon Masters is a kernel hacker who’s been involved with Linux for over 22 years, and works on energy-efficient Arm servers. “One theme of 2024 was Confidential Compute, with Intel, AMD and Arm all pushing hard to get patches upstream. Intel’s TDX (Tr

Related Books & Audiobooks