Elastic Agent command line options

edit

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.

Elastic Agent provides commands for running the agent and doing common tasks:


elastic-agent enroll

edit

Enroll the Elastic Agent in Fleet.

We recommend that you run this command as the root user because some integrations require root privileges to collect sensitive data. This command overwrites the elastic-agent.yml file in the agent directory.

Synopsis
edit
elastic-agent enroll <kibana_url> <enrollment_token> [--ca-sha256 <string>]
                     [--certificate-authorities <string>] [--force] [--help]
                     [--insecure][global-flags]
Options
edit
kibana_url
Required. URL of the Kibana endpoint where Ingest Manager is running.
enrollment_token
Required. Enrollment token generated by Ingest Manager. You can use the same enrollment token for multiple agents.
--ca-sha256 <string>
Comma-separated list of certificate authority hash pins used for certificate verification.
--certificate-authorities <string>
Comma-separated list of root certificates used for server verification.
--force
Force overwrite of current configuration without prompting for confirmation. This flag is helpful when using automation software or scripted deployments.
--help
Show help for the enroll command.
--insecure
Allow an insecure connection to Kibana. When this flag is specified, API keys are sent in clear text. We strongly recommend that you use a secure connection.

For more flags, see Global flags.

Example
edit
elastic-agent enroll http://localhost:5601 ZnmNIdzVITUJua2QIdU5FTWROVjY6dHY2N1EybWNTMUdPejg5ODbYcVpNUQ==

elastic-agent help

edit

Show help for a specific command.

Synopsis
edit
elastic-agent help <command> [--help] [global-flags]
Options
edit
command
The name of the command.
--help
Show help for the help command.

For more flags, see Global flags.

Example
edit
elastic-agent help enroll

elastic-agent inspect

edit

Show the current Elastic Agent configuration.

If no parameters are specified, shows the full Elastic Agent configuration.

Synopsis
edit
elastic-agent inspect [--help] [global-flags]
elastic-agent inspect output [--output <string>] [--program <string>]
                             [--help] [global-flags]
Options
edit
output

Display the current configuration for the output. This command accepts additional flags:

--output <string>
The name of the output to introspect.
--program <string>
The type of program to introspect. For example, filebeat. This option must be combined with --output.
--help
Show help for the inspect command.

For more flags, see Global flags.

Examples
edit
elastic-agent inspect
elastic-agent inspect output --output default
elastic-agent inspect output --output default --program filebeat

elastic-agent run

edit

Start the elastic-agent process.

Synopsis
edit
elastic-agent run [global-flags]
Global flags
edit

These flags are valid whenever you run elastic-agent on the command line.

-c <string>
The configuration file to use. If not specified, Elastic Agent uses {path.home}/elastic-agent.yml.
--e
Log to stderr and disable syslog/file output.
--environment <environmentVar>
The environment in which the agent will run.
--path.config <string>
The directory where Elastic Agent looks for its configuration file. The default varies by platform.
--path.data <string>

The data directory where Elastic Agent stores managed binaries and their logs. Also stores logs for any programs started and managed by Elastic Agent.

If not specified, Elastic Agent uses {path.home}/data.

--path.home <string>

The home directory of Elastic Agent. path.home determines the location of the configuration files and data directory.

If not specified, Elastic Agent uses the current working directory.

--path.logs <string>
Path to the log output for Elastic Agent. The default varies by platform.
--v
Set log level to INFO.
Example
edit
elastic-agent run -v --path.logs path/to/my/logs

elastic-agent version

edit

Show the version of Elastic Agent.

Synopsis
edit
elastic-agent version [--help] [global-flags]
Options
edit
--help
Show help for the version command.

For more flags, see Global flags.

Example
edit
elastic-agent version