Skip to content

Commit feb1d08

Browse files
authored
Add common parameters of <storage> section (#639)
Fluent::Plugin::Storage defines four parameters common to every storage plugin, but they were not documented anywhere. lib/fluent/plugin/storage.rb:29-32 config_param :persistent, :bool, default: false # load/save with all operations config_param :autosave, :bool, default: true config_param :autosave_interval, :time, default: 10 config_param :save_at_shutdown, :bool, default: true The described behaviour follows lib/fluent/plugin_helper/storage.rb: * #wrap_instance (l.182-192) wraps the storage in PersistentWrapper when `persistent` is true, which loads before and saves after each operation. * #start (l.124-132) registers the autosave timer only when `autosave && !persistent`. * #shutdown (l.159-164) saves when `save_at_shutdown` is true, regardless of the other three. Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
1 parent c70a3e3 commit feb1d08

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

configuration/storage-section.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,23 @@ Third-party plugins may also be installed and configured.
3838

3939
For more details, see plugins documentation.
4040

41+
## Parameters
42+
43+
{% hint style='info' %}
44+
NOTE: It depends on a plugin's capabilities whether can handle a `<storage>` section or not. See each plugin's documentation in detail.
45+
{% endhint %}
46+
47+
The following parameters are common to all storage plugins. Individual storage plugins may add their own parameters. See each plugin's documentation in detail.
48+
49+
* **`persistent`** \(bool\) \(optional\): If `true`, the storage reloads its data from the data source before every read/write operation and saves it back after every write operation. This keeps the data source always up-to-date at the cost of an I/O per operation. If `false`, the operations are performed against the in-memory copy only, and saving is left to `autosave` and `save_at_shutdown`.
50+
* Default: `false`
51+
* Note that some plugins require additional configuration to be persistent. For example, [`local`](../storage/local.md) raises a configuration error unless the plugin `@id` or the `path` parameter is given.
52+
* **`autosave`** \(bool\) \(optional\): If `true`, the storage periodically saves its data in the background at the `autosave_interval` interval. This is ignored when `persistent` is `true`, because every operation already saves the data.
53+
* Default: `true`
54+
* **`autosave_interval`** \(time\) \(optional\): The interval of the periodic save enabled by `autosave`.
55+
* Default: `10`
56+
* **`save_at_shutdown`** \(bool\) \(optional\): If `true`, the storage saves its data when the plugin shuts down. This takes effect regardless of `persistent` and `autosave`.
57+
* Default: `true`
58+
4159
If this article is incorrect or outdated, or omits critical information, please [let us know](https://github.com/fluent/fluentd-docs-gitbook/issues?state=open). [Fluentd](http://www.fluentd.org/) is an open-source project under [Cloud Native Computing Foundation \(CNCF\)](https://cncf.io/). All components are available under the Apache 2 License.
4260

0 commit comments

Comments
 (0)