[[configuring-howto-metricbeat]]
= Configuring {beatname_uc}

[partintro]
--
After following the <<metricbeat-configuration,configuration steps>> in the
Getting Started, you might want to fine tune the behavior of {beatname_uc}.
This section describes some common use cases for changing configuration options.

To configure {beatname_uc}, you edit the configuration file. For rpm and deb, you’ll find the configuration file at
+/etc/{beatname_lc}/{beatname_lc}.yml+. There's also a full example configuration file at
+/etc/{beatname_lc}/{beatname_lc}.full.yml+ that shows all non-deprecated options.
For mac and win, look in the archive that you extracted.

See the
{libbeat}/config-file-format.html[Config File Format] section of the
_Beats Platform Reference_ for more about the structure of the config file.

The following topics describe how to configure Metricbeat:

* <<metricbeat-configuration-options>>
* <<filtering-and-enhancing-data>>
* <<configuring-ingest-node>>
* <<config-metricbeat-logstash>>
* <<using-environ-vars>>
* <<yaml-tips>>
* <<regexp-support>>

[float]
== Basic Configuration

A Metricbeat configuration contains a list of modules. Each module contains the following config options:

* `module`: The name of the module to run. For documentation about each module, see the <<metricbeat-modules>> section.
* `metricsets`: A list of metricsets to execute. For a list of available metricsets, see the documentation for the module.
* `enabled`: Specifies whether the module is enabled. 
* `period`: How often the metricsets are executed. 
* `hosts`: A list of hosts to fetch information from. For some modules, such as the System module, this setting is not required.
* `fields`: A dictionary of fields that will be sent with the metricset event. This setting is optional. 
* `tags`: A list of tags that will be sent with the metricset event. This setting is optional.
* `filters`: With filters you can reduce the amount of data that is sent in the event. For more about the available filter options, see <<filtering-and-enhancing-data>>. This setting is optional. 

The following example shows a basic configuration for the Apache module:

[source,yaml]
----
metricbeat:
  modules:
    - module: apache
      metricsets: ["status"]
      hosts: ["http://127.0.0.1/"]
      period: 10s
      enabled: true
      fields:
        dc: west
      tags: ["tag"]
      filters:
        ....
----

[float]
== Configuration Combinations

You can specify a configuration that uses different combinations of modules, metricsets, periods, and hosts. In the following example, the Redis host is crawled for `stats` information every second because this is critical data, but the full list of Apache metricsets is only fetched every 30 seconds because the metrics are less critical.

[source,yaml]
----
metricbeat:
  modules:
    - module: redis
      metricsets: ["info"]
      hosts: ["host1"]
      period: 1s
      enabled: true
    - module: apache
      metricsets: ["info"]
      hosts: ["host1"]
      period: 30s
      enabled: true
----

For a module with multiple metricsets defined, it's possible to define the module twice and specify 
a different period to use for each metricset. For the following example, the `set1` metricset will be fetched every
10 seconds, while the `set2` metricset will be fetched every 2 minutes:

[source,yaml]
----
metricbeat:
  modules:
    - module: example
      metricsets: ["set1"]
      hosts: ["host1"]
      period: 10s
    - module: example
      metricsets: ["set2"]
      hosts: ["host1"]
      period: 2m
----

--

include::reference/configuration.asciidoc[]
