[[elastic-agent-configuration]]
[role="xpack"]
= Policy settings

beta[]

The policy settings for {fleet}-managed agents are specified through the UI.
You do not set them explicitly in a configuration file.

For standalone agents, you need to configure settings in the `elastic-agent.yml`
file. Prior to installation, edit the file located in the extracted {agent}
package. After installation, edit the file located in the directory
described in <<installation-layout>>. 

TIP: To get started quickly, you can use {fleet} to generate a standalone
configuration. For more information, see <<run-elastic-agent-standalone>>.

[discrete]
[[elastic-agent-output-configuration]]
== Output settings

Specify one or more outputs. Specifying multiple outputs allows you to pair
each data source with a different output.

IMPORTANT: {agent} currently works with the {es} output only.

Example output configuration:

[source,yaml]
-------------------------------------------------------------------------------------
outputs:
  default:
    type: elasticsearch
    hosts: [127.0.0.1:9200]
    username: elastic
    password: changeme

  monitoring:
    type: elasticsearch
    api_key: VuaCfGcBCdbkQm-e5aOx:ui2lp2axTNmsyakw9tvNnw
    hosts: ["localhost:9200"]
    ca_sha256: "7lHLiyp4J8m9kw38SJ7SURJP4bXRZv/BNxyyXkCcE/M="
-------------------------------------------------------------------------------------

This example configures two outputs: `default` and  `monitoring`.
Notice that they use different authentication methods. The first one uses a
username and password pair, and the second one contains an API key.

[NOTE]
==============
A default output configuration is required.
==============

[discrete]
[[elastic-agent-monitoring-configuration]]
== {beats} monitoring settings

{agent} monitors {beats} by default. To disable or change monitoring
settings, set options under `agent.monitoring`:

[source,yaml]
-------------------------------------------------------------------------------------
agent.monitoring:
  # enabled turns on monitoring of running processes
  enabled: true
  # enables log monitoring
  logs: true
  # enables metrics monitoring
  metrics: true
  # specifies output to be used
  use_output: monitoring
-------------------------------------------------------------------------------------


To disable monitoring, set `agent.monitoring.enabled` to `false`. When set to
`false`, {beats} monitoring is turned off, and all other options in this section
are ignored.

To enable monitoring, set `agent.monitoring.enabled` to `true`. Also set the
`logs` and `metrics` settings to control whether logs, metrics, or both are
collected. If neither setting is specified, monitoring is disabled. Set
`use_output` to specify the output to which monitoring events are sent.

[discrete]
[[elastic-agent-input-configuration]]
== Input settings

By default {agent} collects system metrics, such as cpu, memory, network, and
filesystem metrics, and sends them to the default output. For example:


[source,yaml]
-------------------------------------------------------------------------------------
inputs:
  - type: system/metrics
    data_stream.namespace: default
    use_output: default
    streams:
      - metricset: cpu
        data_stream.dataset: system.cpu
      - metricset: memory
        data_stream.dataset: system.memory
      - metricset: network
        data_stream.dataset: system.network
      - metricset: filesystem
        data_stream.dataset: system.filesystem
-------------------------------------------------------------------------------------

If `use_output` is not specified, the `default` output is used.

== Reference yaml

The {agent} installation includes an `elastic-agent.reference.yml` file that
describes all the settings available in a standalone configuration.

The contents of the file are included here for your convenience.

[source,yaml]
----
include::elastic-agent-reference-yaml.yml[]
----
