Skip to content

Commit ade1c02

Browse files
Add troubleshooting section for Elastic Agent automatic unenrollment on 401 errors (#4250)
## Summary Adds documentation for Elastic Agent automatic unenrollment behavior when receiving 401 errors during check-in. In versions < 8.19.0 and < 9.1.0, agents are automatically unenrolled after 7 consecutive 401 failures. This behavior was removed in 8.19.0/9.1.0. **Changes:** - Added troubleshooting section "{{agent}} is automatically unenrolled after failed check-ins with 401 errors" to `troubleshoot/ingest/fleet/common-problems.md` - Updated table of contents with new section reference - Documented version-specific behavior for versions < 8.19.0 and < 9.1.0 - Provided resolution steps: re-enrollment process and investigating 401 error causes - Added version-gated admonition explaining behavior change in 8.19.0/9.1.0 - Listed common causes: expired API keys, misconfiguration, authentication issues ## Generative AI disclosure 1. Did you use a generative AI (GenAI) tool to assist in creating this contribution? - [x] Yes - [ ] No 2. Tool(s) and model(s) used: GitHub Copilot <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> > > ---- > > *This section details on the original issue you should resolve* > > <issue_title>[Website]: Add troubleshooting section about failed check-ins and 401</issue_title> > <issue_description>### Type of issue > > None > > ### What documentation page is affected > > https://www.elastic.co/docs/troubleshoot/ingest/fleet/common-problems > > ### What happened? > > We should cover the situation that if an Elastic Agent in versions < 9.1.0 or 8.19.0 gets a 401 while checkin in for more than 7 times, it gets auto-unenrolled. > > This behavior has been changed on 9.1.0 and 8.19.0, removing the auto-unenrollment. > > ### Additional info > > _No response_</issue_description> > > ## Comments on the Issue (you are @copilot in this section) > > <comments> > </comments> > </details> <!-- START COPILOT CODING AGENT SUFFIX --> - Fixes #3708 <!-- START COPILOT CODING AGENT TIPS --> --- 💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: vishaangelova <91186315+vishaangelova@users.noreply.github.com> Co-authored-by: Visha Angelova <visha.angelova@elastic.co>
1 parent d40451f commit ade1c02

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

troubleshoot/ingest/fleet/common-problems.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ Find troubleshooting information for {{fleet}}, {{fleet-server}}, and {{agent}}
5454
* [{{agent}} fails with `Agent process is not root/admin or validation failed` message](#process-not-root)
5555
* [Integration policy upgrade has too many conflicts](#upgrading-integration-too-many-conflicts)
5656
* [{{agent}} hangs while unenrolling](#agent-hangs-while-unenrolling)
57+
* [{{agent}} is automatically unenrolled after failed check-ins with 401 errors](#agent-auto-unenroll-401)
5758
* [On {{fleet-server}} startup, ERROR seen with `State changed to CRASHED: exited with code: 1`](#ca-cert-testing)
5859
* [Uninstalling {{elastic-endpoint}} fails](#endpoint-not-uninstalled-with-agent)
5960
* [API key is unauthorized to send telemetry to `.logs-endpoint.diagnostic.collection-*` indices](#endpoint-unauthorized)
@@ -531,6 +532,59 @@ You can unenroll an agent to invalidate all API keys related to the agent and ch
531532
3. Click **Force unenroll**.
532533
533534
535+
## {{agent}} is automatically unenrolled after failed check-ins with 401 errors [agent-auto-unenroll-401]
536+
537+
In {{agent}} versions prior to 8.19.0 and 9.1.0, if an agent receives a 401 (Unauthorized) error on more than seven consecutive check-ins with {{fleet-server}}, the agent is automatically unenrolled.
538+
539+
To resolve the issue:
540+
541+
:::::{stepper}
542+
543+
::::{step} Re-enroll the agent
544+
545+
* If the agent is still installed on the host, re-enroll it in {{fleet}} to keep the agent's existing state, including any previously ingested data:
546+
547+
1. Open the **Agents** tab, then click **Add agent**.
548+
2. In the **Add agent** flyout, select the agent policy in which to re-enroll the agent.
549+
3. In the **Authentication settings** section, select an enrollment token:
550+
551+
* If one or more active enrollment tokens exist for your agent policy, select one from the dropdown.
552+
* If no active tokens exist, click **Create enrollment token**. For detailed instructions, refer to [Create enrollment tokens](/reference/fleet/fleet-enrollment-tokens.md#create-fleet-enrollment-tokens).
553+
554+
4. Make sure **Enroll in Fleet** is selected.
555+
5. Select the appropriate platform, then copy the `elastic-agent install` command from the UI, and replace `install` with `enroll`.
556+
6. Run the modified command with elevated privileges from the directory where the agent is installed. For example:
557+
558+
```bash
559+
sudo ./elastic-agent enroll --url=<fleet-server-url> --enrollment-token=<token>
560+
```
561+
562+
Refer to the [command reference](/reference/fleet/agent-command-reference.md#elastic-agent-enroll-command) for details about the available options.
563+
564+
* If the agent is no longer installed on the host, reinstall and enroll it in {{fleet}}. Refer to [Install {{fleet}}-managed {{agents}}](/reference/fleet/install-fleet-managed-elastic-agent.md) for detailed instructions.
565+
566+
::::
567+
568+
::::{step} Resolve the underlying issues
569+
570+
Investigate the cause of the 401 errors and resolve the underlying issues to ensure proper agent functionality.
571+
572+
401 errors during check-in typically indicate authentication or authorization problems. Common causes include:
573+
574+
* Expired or revoked API keys
575+
* Incorrect {{fleet-server}} configuration
576+
* Issues with {{es}} authentication settings
577+
578+
::::
579+
580+
:::::
581+
582+
:::{admonition} Agents are no longer automatically unenrolled
583+
:applies_to: stack: ga 9.1.0
584+
585+
The automatic unenrollment behavior is removed in {{agent}} versions 8.19.0 and 9.1.0. Starting with these versions, {{agents}} are no longer automatically unenrolled due to repeated 401 errors during check-in. When the issue causing the errors is resolved, the agents automatically reconnect to {{fleet}} and resume ingesting data.
586+
:::
587+
534588
## On {{fleet-server}} startup, ERROR seen with `State changed to CRASHED: exited with code: 1` [ca-cert-testing]
535589
536590
You may see this error message for a number of different reasons. A common reason is when attempting production-like usage and the ca.crt file passed in cannot be found. To verify if this is the problem, bootstrap {{fleet-server}} without passing a ca.crt file. This implies you would test any subsequent {{agent}} installs temporarily with {{fleet-server}}'s own self-signed cert.

0 commit comments

Comments
 (0)