> 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/discovery-and-aggregation.md).

# Discovery and Aggregation

How a discovery run fetches data from your adapters, merges it into unified assets, and how to start, follow and review runs.

A **discovery** is one run in which OctoXLabs fetches data from every enabled connection and then **aggregates** the results into one set of assets. The fetch step collects the raw records that each adapter returns. The aggregation step merges records that describe the same asset into a single unified asset, adds cross-adapter fields and refreshes everything that depends on asset data: counts, charts, widgets and security scores.

You rarely need to touch this process. Read this page when you want to start a run yourself, follow its progress, find out why a connection or step failed, or understand why two records did or did not merge.

### How a discovery run works

A run has two phases. The progress bar in the header and on the discovery detail page covers both.

{% stepper %}
{% step %}

#### Check connections

OctoXLabs takes every **enabled** connection and runs a connection test through the connector that the connection uses. A connection that fails its test is marked as failed for this run and skipped. The other connections continue. If no enabled connection passes, the run ends with the status **Failed**.
{% endstep %}

{% step %}

#### Fetch from the adapters

Each connector runs its adapters and sends the records it collects to OctoXLabs, one inventory at a time (devices, users, certificates, services and so on, depending on what the adapter supports). You can follow every connection on the discovery detail page. See How adapters work for what an adapter collects.
{% endstep %}

{% step %}

#### Aggregate and enrich

When all connectors have reported, aggregation starts. It merges the fetched records into unified assets, then runs the post-aggregation steps: tags and notes, software and vulnerability enrichment, merge recommendations, security score calculation, query, tag and profile counts, and the data behind charts and widgets. A discovery is **Completed** only after these steps finish.
{% endstep %}
{% endstepper %}

The **Duration** column of the discovery history shows the total time. Hover the info icon next to it to see how much of that was **Connection Duration** (fetch) and how much was **Aggregation Duration**.

#### Full and adapter-based discoveries

A **full discovery** runs all enabled connections. An **adapter-based discovery** runs only the connections or adapters that you pick in a schedule, so one slow source can refresh more often than the rest. The discovery history marks every run with a **Full Discovery** column.

* An adapter-based discovery needs an earlier full discovery. If none has completed or is running, the adapter-based run ends as failed.
* An adapter-based discovery adds its results to the data of the last full discovery instead of building a new data set.
* By default a full discovery also runs the connections that have an adapter-based schedule. Turn off **Add Adapterized Adapters to Full Discovery** under Advanced Settings to leave them out. See Advanced Settings.

To set when each kind of run starts, see Discovery Schedule.

### How aggregation merges and correlates assets

Different adapters describe the same real-world asset in different ways, so the aggregation step correlates records before it writes the unified asset.

| Inventory                                                                                | How records are matched                                                                                                                                                |
| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Devices                                                                                  | In three passes, by hostname, then by MAC address, then by IP address. Records that match in a pass become one device. You can also merge devices yourself, see below. |
| Users                                                                                    | By user name.                                                                                                                                                          |
| Certificates, services, source codes, AI services, domains, licenses, policies, web apps | Each record is kept as its own asset.                                                                                                                                  |

For a merged device, OctoXLabs keeps the data of every contributing adapter and adds fields that describe the whole asset, such as `Adapters`, `Groups`, `Hostname`, `FirstSeen`, `LastSeen` and `Tags`. Fields that exist only for one adapter appear under `Specifics`. Because the result lists every adapter, you can query for gaps, for example devices that one tool reports and another does not. See OctoXLabs Query Reference.

When the order of adapters matters for a field, for example which adapter's value is shown when two disagree, set it under Discovery Ordering. See Discovery Ordering.

#### Merge devices that automatic matching misses

Automatic matching cannot know that `octoxlabs01` and `octoxlabs01.octo.example.com` are the same machine. Two features help:

* **Merge Recommendations:** after each discovery OctoXLabs suggests devices that look like the same asset, based on shared IP addresses, shared MAC addresses and similar hostnames. You find them under **Inventories** > **Devices** > **Merge Recommendations**. Select the devices and choose **Merge Devices** to create a relation between them, and pick the **Primary Hostname**.
* **Relations:** the relations you created, also under **Inventories** > **Devices**. A relation is applied at the start of aggregation in every following discovery.

You can turn the three kinds of recommendation (IP, MAC, hostname) on or off, set the number of first and last hostname characters that are compared (**First N Character Recommendation** and **Last N Character Recommendation**, both 15 by default), and turn on **Enable Auto Merge** on the **Merge Recommendation** tab of Advanced Settings. With Auto Merge on, recommendations are merged without review. The primary record is the one with more adapters. If the adapter counts are equal, the one with the more recent `LastSeen` wins.

{% hint style="warning" %}
Auto Merge is off by default. Merge only what you are sure about: when automatic merging is on, recommendations are applied without a review step, so a wrong match merges two real assets.
{% endhint %}

### Start a discovery manually

You need the permission to start discoveries. The **Start Discovery** control does not appear without it.

{% stepper %}
{% step %}

#### Open the Discovery panel

In the header at the top of the console, find the **Discovery** panel. It shows the status and progress of the latest run.
{% endstep %}

{% step %}

#### Start the run

Click **Start Discovery**, then confirm with **Start**. The confirmation reads "This will start a new discovery process. This action cannot be undone."
{% endstep %}

{% step %}

#### Follow the progress

The progress bar fills as connections finish, and the control shows the elapsed time. Click **Discovery** to see the last five runs, or open the full list with **History**.
{% endstep %}
{% endstepper %}

If another discovery is already running, the new full discovery waits with the status **Pending** and starts after the running one finishes. The **Start Discovery** control is replaced by the elapsed time while a run is in progress. A manual start is recorded in the activity logs, see User Activities.

### Run status and history

Open the history from the **Discovery** panel in the header with **History** (the list is titled **Discovery History**). Each row is one run.

| Column                                        | What it shows                                                             |
| --------------------------------------------- | ------------------------------------------------------------------------- |
| **#**                                         | The run number. Click it to open the detail page.                         |
| **Create Time**, **Start Time**, **End Time** | When the run was requested, started and ended.                            |
| **Duration**                                  | Total time. Hover the info icon for the connection and aggregation split. |
| **Completed at**                              | How long ago the run ended.                                               |
| **Full Discovery**                            | Yes for a full discovery, no for an adapter-based one.                    |
| **Status**                                    | **Running**, **Completed**, **Failed** or **Pending**.                    |

To delete runs, select them and choose **Actions** > **Delete Selected**, or use the delete action on a row. A running discovery cannot be deleted. Deleting a run removes the data it holds. You can also let OctoXLabs delete old runs on its own with **Discovery Keep Days** (0 means keep all) and **Clear daily stale discoveries** in Advanced Settings.

#### The discovery detail page

Click a run number to open **Discovery at** the run's date. The page shows:

* A summary message: **Discovery Completed**, **No issues found.**, or a list of problems, such as **Failed Connections Count**, **Failed Operations Count**, or a warning when CPU or memory usage is above 50%.
* **Connections Status:** one card per connection and inventory with its status (**In Progress**, **Queued**, **Done**, **Error** or **Connection Test Failed**), the **Last log**, **Start Time**, **End Time** and **Processing Time**. Use **Search Connections** and the status and adapter filters to narrow the list.
* **Discovery Operations:** the aggregation and post-aggregation steps in order, such as **Merge Devices**, **Aggregate Devices**, **Octoxlabs Security Score Calculation**, **Update Widget Data** and **AVM Vulnerability Enrichment**. Each step shows its status (**Done**, **In Progress**, **Error**, **Skipped**, **Queued**), start and completion time, duration and queue time. A step that does not apply to your setup is **Skipped**. The steps you see depend on your version and configuration.
* **System Information:** CPU and memory use of the server.
* **Download Discovery Logs:** downloads the logs of this run, which is the first thing to attach to a support request.

IMAGEHERE: The discovery detail page of a completed run, showing the summary message, a few connection cards and the Discovery Operations list.

<details>

<summary>A discovery fails before it fetches anything</summary>

* **No connection is reachable.** Every enabled connection failed its connection test, or none is enabled. The run ends as **Failed**. Open the detail page, check the **Last log** of each connection and fix the connection. See Connect an adapter.
* **The disk is nearly full.** OctoXLabs does not start a discovery when disk usage is too high, and it records a system activity "Disk usage exceeded 80%". Free or add disk space, then start again.
* **An adapter-based run has no full discovery to build on.** Run a full discovery first.

</details>

### 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>Discovery Schedule</strong></td><td>Run full and adapter-based discoveries automatically.</td><td></td></tr><tr><td><strong>Discovery Ordering</strong></td><td>Decide which adapter wins when records disagree.</td><td></td></tr><tr><td><strong>Asset Inventory</strong></td><td>Browse the unified assets a discovery produces.</td><td></td></tr><tr><td><strong>Security Policies</strong></td><td>See how the security score is calculated after aggregation.</td><td></td></tr></tbody></table>
