You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: buffer/file.md
+87-26Lines changed: 87 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -9,50 +9,86 @@ The `file` buffer plugin provides a persistent buffer implementation. It uses fi
9
9
10
10
### `path`
11
11
12
-
| type | required | default | version |
13
-
| :--- | :---: | :--- | :--- |
14
-
| string | ✔ || 0.9.0 |
15
-
16
-
The path where buffer chunks are stored. The '\*' is replaced with random characters. This parameter is required.
17
-
18
-
This parameter must be unique to avoid the race condition problem. For example, you cannot use a fixed path parameter in `fluent-plugin-forest`. `${tag}` or similar placeholder is needed. Of course, this parameter must also be unique between fluentd instances.
12
+
| type | default | version |
13
+
| :--- | :--- | :--- |
14
+
| string | nil | 0.9.0 |
19
15
20
-
In addition, `path` should not be another `path` prefix. For example, the following configuration does not work well. `/var/log/fluent/foo` resumes `/var/log/fluent/foo.bar`'s buffer files during start phase and it causes `No such file or directory` in `/var/log/fluent/foo.bar` side.
16
+
The directory path where buffer chunks are stored. Don't share this directory path with other buffers.
17
+
Be sure to specify a unique path for each buffer.
21
18
22
19
```text
23
-
<match pattern1>
20
+
<match pattern>
21
+
...
24
22
<buffer>
25
23
@type file
26
-
path /var/log/fluent/foo
24
+
path /var/log/fluent/buf
27
25
</buffer>
28
26
</match>
27
+
```
29
28
30
-
<match pattern2>
31
-
<buffer>
32
-
@type file
33
-
path /var/log/fluent/foo.bar
34
-
</buffer>
35
-
</match>
29
+
This config outputs the buffer chunk files as follows. The file name is `buffer.b{chunk_id}{path_suffix}`.
If you specify `root_dir` in [system configuration](../deployment/system-config.md) and [@id](../configuration/plugin-common-parameters.md#id) of the plugin,
66
+
then you can omit this parameter.
67
+
68
+
```text
69
+
<system>
70
+
root_dir /var/log/fluentd
71
+
</system>
72
+
73
+
...
47
74
48
-
<match pattern2>
75
+
<match pattern>
76
+
@id test_id
77
+
...
49
78
<buffer>
50
79
@type file
51
-
path /var/log/fluent/foo.bar
52
80
</buffer>
53
81
</match>
54
82
```
55
83
84
+
This config outputs the buffer chunk files as follows. The directory `{root_dir}/worker{worker_id}/{@id}/buffer` is used for the path.
85
+
In this case, the `worker{worker_id}` directory is created even for a single worker.
Please make sure that you have **enough space in the path directory**. Running out of disk space is a problem frequently reported by users.
57
93
58
94
### `path_suffix`
@@ -75,22 +111,47 @@ Changes the suffix of the buffer file.
75
111
76
112
This parameter is useful when `.log` is not fit for your environment. See also [this issue's comment](https://github.com/fluent/fluentd/issues/2236#issuecomment-514733974).
77
113
78
-
## Example
114
+
## Tips
115
+
116
+
### Customize a filename of the buffer chunk
117
+
118
+
You can customize the prefix of filename (`buffer` by default) by adding `.*` to the end of the `path` parameter.
79
119
80
120
```text
81
121
<match pattern>
122
+
...
82
123
<buffer>
83
124
@type file
84
-
path /var/log/fluent/myapp.*.buffer
125
+
path /var/log/fluent/buf/custom.*
85
126
</buffer>
86
127
</match>
87
128
```
88
129
89
-
## Tips
130
+
This config outputs the buffer chunk files as follows. The prefix `buffer` is changed to `custom`.
If you use this plugin under the multi-process environment, you need to use `@id`/`root_dir` parameters instead of fixed `path` parameter. See [Multi Process Workers](../deployment/multi-process-workers.md#root_dir-id-parameter) article.
137
+
You can also customize the entire filename by adding `.*.` to the `path` parameter.
Copy file name to clipboardExpand all lines: deployment/multi-process-workers.md
-39Lines changed: 0 additions & 39 deletions
Original file line number
Diff line number
Diff line change
@@ -131,45 +131,6 @@ As of Fluentd v1.4.0, `<worker N-M>` syntax has been introduced:
131
131
132
132
With this directive, you can specify multiple workers per worker directive.
133
133
134
-
### `root_dir/@id` parameter
135
-
136
-
These parameters must be specified when you use the file buffer.
137
-
138
-
With multi-process workers, you cannot use the fixed `path` configuration for file buffer because it conflicts buffer file path between processes.
139
-
140
-
```text
141
-
<system>
142
-
workers 2
143
-
</system>
144
-
145
-
<match pattern>
146
-
@type forward
147
-
<buffer>
148
-
@type file
149
-
path /var/log/fluentd/forward # This is not allowed
150
-
</buffer>
151
-
</match>
152
-
```
153
-
154
-
Instead of a fixed configuration, fluentd provides the dynamic buffer path based on `root_dir` and `@id` parameters. The stored path is `${root_dir}/worker${worker index}/${plugin @id}/buffer` directory.
155
-
156
-
```text
157
-
<system>
158
-
workers 2
159
-
root_dir /var/log/fluentd
160
-
</system>
161
-
162
-
<match pattern>
163
-
@type forward
164
-
@id out_fwd
165
-
<buffer>
166
-
@type file
167
-
</buffer>
168
-
</match>
169
-
```
170
-
171
-
With this configuration, `forward` output buffer files are stored into `/var/log/fluentd/worker0/out_fwd/buffer` and `/var/log/fluentd/worker1/out_fwd/buffer` directories.
172
-
173
134
## Operation
174
135
175
136
Each worker consumes memory and disk space separately. Take care while configuring buffer spaces and monitoring memory/disk consumption.
0 commit comments