Install Elastic Agent and enroll it in Fleetedit

This functionality is in beta and is subject to change. The design and code is less mature than official GA features and is being provided as-is with no warranties. Beta features are not subject to the support SLA of official GA features.

Install an Elastic Agent on each host that you want to monitor. These steps assume that you’re running a fresh installation. If Elastic Agent is already running on your system and you want to upgrade to a new version, see Upgrade Elastic Agent.

Before running the installation, decide whether you want to use Fleet to manage your agents in a central location in Kibana (recommended), or run standalone agents.

With Fleet, you enroll each agent in a policy defined in Kibana. The policy specifies how to collect observability data from the services you want to monitor. The agent connects to a trusted Kibana instance to retrieve the policy and report agent events.

We recommend using Fleet management because it makes the management and upgrade of your agents considerably easier. If you want to run standalone agents, instead of using Fleet, see Run Elastic Agent standalone (advanced users).

To install Elastic Agent and enroll it in Fleet:

  1. If you’re running Elastic Agent 7.9 or earlier, stop the agent and manually remove it from your host.
  2. On your host, download and extract the installation package.

    curl -L -O https://artifacts.elastic.co/downloads/beats/elastic-agent/elastic-agent-7.12.1-darwin-x86_64.tar.gz
    tar xzvf elastic-agent-7.12.1-darwin-x86_64.tar.gz
  3. From the agent directory, run the appropriate command to install Elastic Agent as a managed service, enroll it in Fleet, and start the service. Don’t have a Fleet enrollment key? Read the Quick start guide to learn how to get one from Fleet.

    You must run this command as the root user because some integrations require root privileges to collect sensitive data.

    sudo ./elastic-agent install -f --kibana-url=<kibana_url> --enrollment-token=<enrollment_token>  

    kibana_url is the Kibana URL where Fleet is running, and enrollment_token is the enrollment token acquired from Fleet.

    Omit -f to run an interactive installation.

    This step installs the Elastic Agent files into the directory locations described in Installation layout.

Because Elastic Agent is installed as an auto-starting service, it will restart automatically if the system is rebooted.

To confirm that Elastic Agent is installed and running, go to the Agents tab in Fleet.

If you run into problems, see Troubleshoot common problems.

Installation layoutedit

When you run the install command, Elastic Agent installs files in the following locations. You cannot override these installation paths because they are required for upgrades.

/Library/Elastic/Agent/*
Elastic Agent program files
/Library/Elastic/Agent/elastic-agent.yml
Main Elastic Agent configuration
/Library/Elastic/Agent/fleet.yml
Main Elastic Agent Fleet configuration
/Library/Elastic/Agent/data/elastic-agent-*/logs/elastic-agent-json.log
Log files for Elastic Agent[1]
/Library/Elastic/Agent/data/elastic-agent-*/logs/default/*-json.log
Log files for Beats shippers
/usr/bin/elastic-agent
Shell wrapper installed into PATH
[1] Logs are numbered log.1, log.2, and so on as they are rotated off the main log.