YAML Tips and Gotchas

edit

When you edit the configuration file, there are a few things that you should know.

Use Spaces for Indentation

edit

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

In the default configuration files and in all the examples in the documentation, we use 2 spaces per indentation level. We recommend you do the same.

Look at the Default Config File for Structure

edit

The best way to understand where to define a configuration option is by looking at the provided sample configuration files. The configuration files contain most of the default configurations that are available per beat. To change a setting, simply uncomment the line and change the values.

Test Your Config File

edit

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 your Beat in the foreground with the -configtest flag specified. For example:

filebeat -c filebeat.yml -configtest

You’ll see a message if an error in the configuration file is found.

Wrap Regular Expressions in Single Quotation Marks

edit

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/.