> For the complete documentation index, see [llms.txt](https://docs.octoxlabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.octoxlabs.com/documentation/use-octoxlabs/queries/query-examples.md).

# Query Examples

Ready-to-use queries for common questions: coverage gaps, stale assets, installed software, vulnerabilities, expiry and reuse.

Each example answers one question. Paste the query into the search box of the inventory named above it, or into the **Query Wizard**, which reads the text and shows it as rows. Then adjust the adapter names and values to your environment. For the syntax behind every example, see the OctoXLabs Query Reference. To keep a query, see Create and Save Queries.

All examples were checked against the OctoXLabs query parser. Adapter names are slugs such as `falcon-crowdstrike`. Use the slug of the adapters you have connected.

{% hint style="info" %}
Examples that use `Specifics.<adapter-slug>.<key>` work in the inventories only. The Asset Explorer does not hold adapter-specific fields.
{% endhint %}

### Find coverage gaps

Run these in **Inventories** > **Devices**. They list devices that one tool reports and another does not.

```
OS.Type = Windows AND Category = Server AND NOT Adapters = falcon-crowdstrike
```

```
Adapters = active-directory AND NOT Adapters = servicenow-cmdb AND Category = Server
```

```
Category = Workstation AND NOT Adapters = sccm AND NOT Adapters = falcon-crowdstrike
```

```
(Adapters = dhcp-server OR Adapters = infoblox-ddi) AND NOT Adapters = active-directory
```

The last example puts the `OR` group in parentheses so that the `NOT` condition applies to the whole group.

### Find stale assets

```
Category = Workstation AND NOT LastSeen last now-30d/d
```

```
Category = Server AND OS.Type = Linux AND NOT LastSeen last now-7d/d
```

```
LastSeen >= 2026-01-01 AND LastSeen <= 2026-03-31
```

```
LastSeen lastm now-120m/m
```

{% hint style="info" %}
In an inventory, `now-30d/d` is counted back from the end of the discovery you selected, not from today. In the Asset Explorer it is counted back from today.
{% endhint %}

### Find installed software

Run these in **Inventories** > **Devices**.

```
Category = Server AND {InstalledSoftware[SoftwareName ~ notepad]}
```

```
{InstalledSoftware[SoftwareName = Mozilla;; SoftwareVersion = 11.0]}
```

```
NOT InstalledSoftware.SoftwareName = *
```

The braces make both conditions apply to the same list item. In the **Query Wizard**, use **Add Nested Row** for this. To look software up from the software side, run these in **Inventories** > **Software**:

```
Name ~ microsoft AND Version > 7
```

```
Name ~ adobe AND VulnerabilityCount > 0
```

### Prioritize vulnerabilities

Run these in **Inventories** > **Devices**.

```
Category = Server AND (OctoVulnerabilities.Cvss3Scores >= 9 OR Vulnerabilities.Cvss3Base >= 9)
```

```
OctoVulnerabilities.Id = CVE-2025-2857
```

```
{Vulnerabilities[Severity = Critical;; Modified >= 2025-11-01]}
```

`OctoVulnerabilities` holds the CVEs OctoXLabs matched to the device, and `Vulnerabilities` holds the raw findings of your scanners, so the first example searches both. For the difference, see the vulnerability score filters under the Devices tab in the OctoXLabs Query Reference. To start from the CVE side, use **Inventories** > **Vulnerabilities**:

```
MaxCvss3Score >= 9
```

### Check expiry

Run these in **Inventories** > **Certificates** or **Licenses**.

```
ExpiryStatus = expiring
```

```
ExpiryStatus = expired AND ExpiryDate last now-3d/d
```

```
ExpiryDate next now+60d/d
```

`next` is a shorthand for "less than or equal to", so the last example also matches licenses that have already expired.

### Look up users

Run these in **Inventories** > **Users**.

```
Adapters = active-directory AND Adapters = azure-ad
```

```
AdapterCount >= 2
```

```
Specifics.active-directory.memberOf ~ Domain Admins
```

For more Active Directory examples and the reason `MembersOf` is not used, see the Users tab of the OctoXLabs Query Reference.

### Search by pattern, list or empty field

These operators are available in OctoXLabs 6.7.0 and later. The **Query Wizard** writes them for you with the operators **regex**, **in** and **is**.

```
Hostname RE //^(web|app)-[0-9]+$// AND Category = Server
```

```
IpAddresses IN [[10.0.0.1, 10.0.0.2, 10.0.0.3]]
```

```
Domain is EMPTY
```

```
Domain is ANY
```

### Reuse saved queries

`Query is <query ID>` includes the result of another saved query. Build one base query, and add conditions on top of it. A new installation includes these base queries on the **Saved Queries** page of the **Devices** inventory:

| ID                       | Name                           | Query                                                    |
| ------------------------ | ------------------------------ | -------------------------------------------------------- |
| `octoxlabs-initial-0001` | Last 30 Days Workstation       | `Category = Workstation AND LastSeen last now-30d/d`     |
| `octoxlabs-initial-0002` | Last older 30 Days Workstation | `Category = Workstation AND NOT LastSeen last now-30d/d` |
| `octoxlabs-initial-0017` | Last 15 days server            | `Category = Server AND LastSeen last now-15d/d`          |
| `octoxlabs-initial-0018` | Last older 15 days server      | `Category = Server AND NOT LastSeen last now-15d/d`      |
| `octoxlabs-initial-0023` | Other Devices Query            | `Category = Others`                                      |
| `octoxlabs-initial-0024` | MacOsX Workstation Query       | `Category = Workstation AND OS.Type = MacOSX`            |
| `octoxlabs-initial-0025` | Windows Workstation Query      | `Category = Workstation AND OS.Type = Windows`           |
| `octoxlabs-initial-0026` | Linux Server Profile           | `Category = Server AND OS.Type = Linux`                  |
| `octoxlabs-initial-0027` | Windows Server Query           | `Category = Server AND OS.Type = Windows`                |

```
Query is octoxlabs-initial-0001 AND NOT Adapters = sccm
```

```
Query is octoxlabs-initial-0017 AND NOT Adapters = falcon-crowdstrike
```

Use the query ID, not the name. If a query that you include is deleted, the new query stops working. A query cannot include itself, directly or through other queries.

### What's next?

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Create and Save Queries</strong></td><td>Build a query in the Query Wizard and save it.</td><td></td></tr><tr><td><strong>Modify Existing Queries</strong></td><td>Run, edit, copy and delete saved queries.</td><td></td></tr><tr><td><strong>OctoXLabs Query Reference</strong></td><td>Look up operators, fields and syntax.</td><td></td></tr><tr><td><strong>Rules and Triggers</strong></td><td>Run a workflow on the results of a saved query.</td><td></td></tr></tbody></table>
