> For the complete documentation index, see [llms.txt](https://docs.autopilotmonitor.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.autopilotmonitor.com/troubleshooting-and-support/diagnostics-and-log-collection.md). Agents can also search and read this documentation through its [MCP server](https://docs.autopilotmonitor.com/~gitbook/mcp).

# Diagnostics & Log Collection

Collecting evidence when something goes wrong — the diagnostics package and its size limits, additional log paths, session reports, and the agent's own log.

## The diagnostics package

When enabled, the agent bundles the relevant device logs into a ZIP at the end of enrollment and uploads it — so the evidence is already waiting when you open a failed session (**Download Diagnostics** button on the session detail page). In pre-provisioning (White Glove) scenarios with upload mode `Always`, an intermediate package is additionally uploaded when the technician phase completes, so the provisioning evidence is available while the device is still in the depot — without waiting for the user phase weeks later.

Configuration lives under **Settings → Agent → Diagnostics Package** ([full reference](https://docs.autopilotmonitor.com/reference/settings.md#diagnostics-package)):

* **Upload destination** — your own Azure Blob Storage (Container SAS URL; data never leaves your tenant) or the built-in hosted storage (short-lived, write-only upload tokens; no storage account needed).
* **Upload Mode** — `Always`, `On Failure Only` (recommended), or `Off`.
* **Additional Log Paths** — extend the default collection with your own folders, files or wildcard patterns: a folder path collects every file in that folder, wildcards go in the last path segment, environment variables, and the `%LOGGED_ON_USER_PROFILE%` token for user-profile logs (limited to `AppData\Local`/`Roaming`), optionally with subfolders. Paths are validated against an agent-side allow-list of known log locations.

The built-in collection covers the agent's own logs, state, pending uploads and completion markers, the Intune Management Extension logs, the Device Preparation bootstrapper event log on Autopilot Device Preparation enrollments, and — when the RealmJoin Watcher is enabled — the RealmJoin client, package, Chocolatey and per-user logs. The exact list is shown read-only under **Settings → Agent → Diagnostics Package → Built-in**, together with any platform-wide paths. Everything else (Windows Setup/Panther logs, SetupDiag, other event logs, vendor logs) is added through Additional Log Paths.

### Size limits

The agent caps every package, so a runaway log or an overly broad path cannot turn into a huge upload:

| Limit                     | Value                             |
| ------------------------- | --------------------------------- |
| Single file               | 100 MB — larger files are skipped |
| Total size (uncompressed) | 500 MB per package                |
| Number of files           | 5,000 per package                 |

The limits apply to the whole package, built-in collection and Additional Log Paths together. The built-in collection is added first, so a broad Additional Log Path cannot push out the agent or IME logs, but it can use up the remaining budget for the paths listed after it. A file that does not fit is left out entirely, never cut off — every file in the ZIP is complete. When files were left out, the session timeline's diagnostics event says how many, and the ZIP contains `_TRUNCATED.txt` listing each skipped file with its size and the reason; `package-manifest.txt` records every packaging decision. Logs compress well, so the uploaded ZIP is usually a fraction of the uncompressed size.

## The agent's own log

`%ProgramData%\AutopilotMonitor\Logs` on the device records the agent's startup, guard decisions, collection activity, and every backend interaction. Two settings matter when hunting an agent problem:

* **Keep Log File** — preserves the log through self-destruct.
* **Log Level** — raise to Debug/Verbose only while diagnosing; remember it applies to new enrollments.

For suspected IME-pattern issues there is a dedicated **IME Pattern Match Log** ([details](https://docs.autopilotmonitor.com/rules/ime-log-patterns.md#contributing-patterns)).

## Reporting a session

The **Report Session** action on any session detail page (Tenant Admins and Operators) sends a report including your comment and contact address, with optional screenshot and agent-log attachments. Logs are compressed before sending; the form shows how much of the size budget your attachments use. The session's timeline exports are attached automatically when they fit next to your attachments. If the session has an uploaded diagnostics package, a checkbox lets you include a copy of it with the report; the copy stays with the report even after the session itself is deleted or expires. Use Report Session when you believe the *product* got something wrong (misclassified session, missing events, a rule misfiring); use the diagnostics package when you're troubleshooting *your* enrollment.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.autopilotmonitor.com/troubleshooting-and-support/diagnostics-and-log-collection.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
