You can control the flow of event stream using the configuration file. It describes the format of the file.
Configuration file is stored on $install_prefix/etc/fluent/fluent.conf. If it not exist, create it using following command:
$ sudo fluentd --setup /etc/fluent $ edit /etc/fluent/fluent.conf
Configuration file consists of <source> directives and <match> directives.
<source> describes an entrance of events, like http
or tcp
.
<match> describes the match pattern of events and an exit of the matched events, like myapp.accesslog.**
to file
.
Overview of the configuration file will be like as following:
# Receive events from 24224/tcp # This is used by log forwarding and fluent-cat command <source> type tcp port 24224 </source> # http://this.host:9880/myapp.access?json={"event":"data"} <source> type http path 9880 </source> # Match events tagged with "myapp.access" and # store them to /var/log/fluent/access.%Y-%m-%d <match myapp.access> type file path /var/log/fluent/access </match> <match myapp.log.**> type file format /var/log/fluent/myapp.%Y-%m-%d.log buffer_type file buffer_path /var/log/fluent/myapp </match>
<source> directive must have type
parameter that specifies name of the input plugin.
Next step: :ref:`input_plugin`
<match> directive must have match pattern and type
parameter that specifies name of the output plugin.
Next step: :ref:`output_plugin`
You can use following match patterns:
*
matches a tag element.- For example, pattern
a.*
matchesa.b
, but not matchesa
ora.b.c
- For example, pattern
**
matches zero or more tag elements.- For example, pattern
a.**
matchesa
,a.b
anda.b.c
- For example, pattern
{X,Y,Z}
matches X, Y or Z, where X,Y,Z are patterns.- For example, pattern
{a,b}
matchesa
andb
, but not matchesc
- You can use it with
*
and**
patterns, likea.{b,c}.*
ora.{b,c.**}
- For example, pattern