docs: improve example again with more exotic features

Source: https://docs.fluentd.org/v0.12/articles/config-file
This commit is contained in:
cn 2017-11-24 23:06:43 +01:00
parent 3e2a3f0cd0
commit 08ee38e700
2 changed files with 59 additions and 7 deletions

View File

@ -8,7 +8,7 @@ NEW FEATURES:
IMPROVEMENTS: IMPROVEMENTS:
- Add example Fluentd Configuration file using as many Fluentd features as possible even if they are not highlighted correctly - Add example fluent.conf file using as many Fluentd features as possible (even if this package does not highlight it correctly)
## 1.0.0 (November 22, 2017) ## 1.0.0 (November 22, 2017)

View File

@ -4,17 +4,23 @@
<source> <source>
@type forward @type forward
port 24224 port 24224
str_param "foo # This line is converted to "foo\nbar". NL is kept in the parameter str1a_param "foo"
str1b_param "foo
bar" bar"
str2a_param 'foo'
str2b_param 'foo
bar'
str2c_param "foo\nbar" # \n is interpreted as actual LF character
array_param [ array_param [
"a", "b" "a", "b"
] ]
hash_param { hash_param {
"k":"v", "k": "v",
"k1":10 "k1": 10
} }
host_param "#{Socket.gethostname}" # host_param is actual hostname like `webserver1`. host_param "#{Socket.gethostname}" # host_param is actual hostname like `webserver1`.
env_param "foo-#{ENV["FOO_BAR"]}" # NOTE that foo-"#{ENV["FOO_BAR"]}" doesn't work. env_param "foo-#{ENV["FOO_BAR"]}" # NOTE that foo-"#{ENV["FOO_BAR"]}" doesn't work.
tag "test.#{ENV['PROJECT_NAME']}"
</source> </source>
<source> <source>
@ -28,14 +34,16 @@
port 9880 port 9880
</source> </source>
<filter myapp.access> <filter foo.bar>
@type record_transformer @type record_transformer
<record> <record>
host_param "#{Socket.gethostname}" hostname "#{Socket.gethostname}"
tag ${record["project_name"]}.scope.${tag}_old
key.flatten x
</record> </record>
</filter> </filter>
<match myapp.access> <match myapp.access yourapp.access>
@type file @type file
path /var/log/fluent/access path /var/log/fluent/access
</match> </match>
@ -47,6 +55,10 @@
</filter> </filter>
<match **> <match **>
@type s3 @type s3
include_tag_key true
buffer_chunk_limit 2M
buffer_queue_limit 32
flush_interval 5s
# ... # ...
</match> </match>
</label> </label>
@ -61,3 +73,43 @@
# Include config files in the ./config.d directory # Include config files in the ./config.d directory
@include config.d/*.conf @include config.d/*.conf
# =======================
# v1_literal_example.conf
# =======================
<section1>
key1 'text' # text
key2 '\'' # ' (1 char)
key3 '\\' # \ (1 char)
key4 '\t' # \t (2 char)
key5 '\[' # \[ (2 char)
key6 '\\[' # \[ (2 char)
key7 '#t' # #t (2 char)
key8 '\#{test}' # \#{test} (8 char)
key9 '#{test}' # #{test} (7 char)
key10 '\[(?<time>[^\]]*)\] (?<message>.*)' # \[(?<time>[^\]]*\] (?<message>.*)
</section1>
<section2>
key1 "text" # text
key2 "\"" # " (1 char)
key3 "\\" # \ (1 char)
key4 "\t" # TAB (1 char)
key5 "\[" # [ (1 char)
key6 "\\[" # \[ (2 char)
key7 "#t" # #t (2 char)
key8 "\#{test}" # #{test} (7 char)
key9 "#{test}" # replaced by eval('test')
key10 "\\[(?<time>[^\\]]*)\\] (?<message>.*)" # \[(?<time>[^\]]*\] (?<message>.*)
</section2>
<section3>
key1 text # text
key2 \ # \ (1 char)
key3 \\ # \\ (2 char)
key4 \t # \t (2 char)
key5 \[ # \[ (2 char)
key6 \\[ # \\[ (3 char)
key7 #t # #t (2 char)
key8 \#{test} # \#{test} (8 char)
key9 #{test} # #{test} (7 char)
key10 \[(?<time>[^\]]*)\] (?<message>.*) # \[(?<time>[^\]]*\] (?<message>.*)
</section3>