YAML Tips and Gotchas

The Metricbeat configuration file uses YAML for its syntax. When you edit the file to modify configuration settings, there are a few things that you should know.

Use Spaces for Indentation

Indentation is meaningful in YAML. Make sure that you use spaces, rather than tab characters, to indent sections.

Look at the Default Config File for Structure

The best way to understand where to define a configuration option is by looking at the metricbeat.yml configuration file. The configuration file contains most of the configuration options that are available for Metricbeat. To change a configuration setting, simply uncomment the line and change the setting.

Test Your Config File

You can test your configuration file to verify that the structure is valid. Simply change to the directory where the binary is installed, and run Metricbeat in the foreground with the -configtest flag specified. For example:

metricbeat -c metricbeat.yml -configtest

You’ll see a message if Metricbeat finds an error in the file.

Wrap Regular Expressions in Single Quotation Marks

If you need to specify a regular expression in a YAML file, it’s a good idea to wrap the regular expression in single quotation marks to work around YAML’s tricky rules for string escaping.

For more information about YAML, see http://yaml.org/.