
Of note: all queries need to be terminated with a ‘semicolon’ in order to execute the query. To run the queries, simply copy and paste the query into your osqueryi console at the osquery> prompt. A query that runs on OSX will not necessarily work on Linux.

Remember: some of these queries are designed for Linux, and others for OSX. Let’s get started running some queries that could be useful for a security team. Try it in the terminal above! You can also run the command by hitting the button at the top right hand corner! Even if you decide to use the osqueryd infrastructure, the osqueryi command line tool is a useful way to test and play around with queries. Osqueryi "select * from processes limit 3 " You can also type your query right after the osqueryi command to run it immediately and exit: Try typing osqueryi below, then running select * from processes Running the osqueryi command line tool will bring you to a “REPL”-like prompt where you can begin to run your queries. To get started, you should try the osqueryi tool. The downsides is that you will need some other infrastructure and tooling to aggregate the output of these queries (e.g., take the osquery output in syslog and store in ElasticSearch for analysis). This mode is extremely useful for detection use cases, when you are doing things like good state detection (e.g., did a new process start since the last check?) or regular behavioral checks for specific indicators of compromise (are any of these network connections suspicious?).
#Osquery manager install#

The pros to this type of deployment is that it’s extremely lightweight and unlikely to have any impact to the endpoint users or application. logging into and running osqueryi queries to pinpoint the endpoint process that has triggered a network indicator to fire. OSQuery information can be used to perform or supplement other live forensics or incident response tasks, e.g. This deployment is useful in DFIR use cases where you are only using osquery in response to detection events from other tools. For performing ad-hoc queries, you only need osqueryi (the command line tool).

One important thing to note as you plan your deployments is that are two main ways to deploy osquery depending on your use case(s). For more information, see the official deployment guide. osquery will require root or system privileges to get a lot of detailed system information, although it is possible to glean some information when not ran as 'root'.
#Osquery manager software#
Osquery is agent software that must run directly on your endpoints (e.g, your OSX installation or Linux servers).
#Osquery manager full#
Select count(pid) as total, name from processes group by name order by total desc limit 10 Īs you can see, you can use standard SQL including limits, aggregates, and joins, you can ask powerful questions about your infrastructure! And you’re not just limited to process information – you can view the full list of ‘tables’ you can query from in the documentation (plus we’ll explore more in the examples below). Return process count, name for the top 10 most active processes Select pid, name, uid, resident_size from processes order by resident_size desc limit 10

osquery at a glance Query for top 10 largest processes by resident memory size We’ll talk about some more of these below. For example: if you suspect a malicious process is running on a system, you can query for the process by name or even a filename it has open. From a security perspective, it can be used to query your endpoints to detect, investigate, and proactively hunt for various types of threats. Osquery is a flexible tool and can be used for a variety of use cases to troubleshoot performance and operational issues. Osquery allows you to craft your system queries using SQL statements, making it easy to use by security engineers that are already familiar with SQL. Osquery is an open source tool created by Facebook for querying various information about the state of your machines. Last updated at Wed, 21:29:25 GMT What is osquery?
