Skip to content
marpaia edited this page Oct 1, 2014 · 47 revisions

osqueryd is the host monitoring daemon which is included with osquery. Running osqueryd --help will surface some interesting configurable options. As of October 1, 2014, the configurable options are as follows:

$ osqueryd --help

  osqueryd
    --help, -h            Print help and usage information

    --config_retriever    The config plugin to use (ex: filesystem, http)
                            Default: filesystem

    --config_path         If using the filesystem config plugin, the path where
                          your osquery JSON config file can be found
                            Default: /var/osquery/osquery.conf

    --log_receiver        The logger plugin to use (ex: filesystem, scribe)
                            Default: filesystem

    --log_dir             The directory which you would like to store your
                          output logs
                            Default: /var/log/osquery/

    -v                    Increase output verbosity
                            Example: -v=3

For detailed information on how you should configure options like log_dir and log_receiver, check out the logging options guide.

For detailed information on how you should configure options like config_path and config_retriever, check out the config options guide.

What does osqueryd do?

osquery is a low-footprint distributed host monitoring daemon which allows you to schedule queries to be executed across your entire infrastructure. The daemon takes care of aggregating the query results over time and generates logs which indicate state changes in your infrastructure. You can use this to maintain insight into the security, performance, configuration and state of your entire infrastructure. osqueryd's logging can integrate right into your internal log aggregation pipeline, regardless of your technology stack, via a robust plugin architecture.

Scheduling queries

Scheduled queries are configured via the config interface. The default here is to just read a JSON file from the local filesystem, but more options exist. If you're interested in integrating osqueryd's config system with your environment, read the config options guide.

Regardless of what config retriever you use (again, the default is the "filesystem" retriever), config files will look kind of like this:

{
  "scheduledQueries": [
    {
      "name": "awesome",
      "query": "SELECT col1, col2, pid FROM awesome_table;",
      "interval": 60
    },
    {
      "name": "foobar",
      "query": "SELECT foo, bar, pid FROM foobar_table;",
      "interval": 600
    }
  ]
}

The above config tells osqueryd to schedule two queries: "awesome" and "foobar". Each query needs a unique name. This name is used internally to reference your query throughout the lifecycle of osqueryd. You then just need to include the text of the SQL query in the "query" field and how often you want it to execute in the "interval" field. So in the above example, "awesome" runs every minute and "foobar" runs every ten minutes.

Event based framework

Clone this wiki locally