# file

The `file` buffer plugin provides a persistent buffer implementation. It uses files to store buffer chunks on disk.

## Example Config

```
<match pattern>
  buffer_type file
  buffer_path /var/log/fluent/myapp.*.buffer
</match>
```

Please see the [Config File](https://docs.fluentd.org/0.12/configuration/config-file) article for the basic structure and syntax of the configuration file.

## Parameters

### buffer\_type (required)

The value must be `file`.

### buffer\_path (required)

The path where buffer chunks are stored. The '\*' is replaced with random characters. This parameter is require

This parameter must be unique to avoid race condition problem. For example, you can't use fixed buffer\_path parameter in fluent-plugin-forest. `${tag}` or similar placeholder is needed. Of course, this parameter must also be unique between fluentd instances.

In addition, `buffer_path` should not be an other `buffer_path` prefix. For example, the following conf doesn't 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.

```
<match pattern1>
    buffer_path /var/log/fluent/foo
</match>

<match pattern2>
    buffer_path /var/log/fluent/foo.bar
</match>
```

Here is the correct version to avoid prefix problem.

```
<match pattern1>
    buffer_path /var/log/fluent/foo.baz
</match>

<match pattern2>
    buffer_path /var/log/fluent/foo.bar
</match>
```

### buffer\_chunk\_limit

The size of each buffer chunk. The default is 8m. The suffixes "k" (KB), "m" (MB), and "g" (GB) can be used. Please see the [Buffer Plugin Overview](https://docs.fluentd.org/0.12/buffer) article for the basic buffer structure.

The default value for Time Sliced Plugin is overwritten as 256m.

### buffer\_queue\_limit

The length limit of the chunk queue. Please see the [Buffer Plugin Overview](https://docs.fluentd.org/0.12/buffer) article for the basic buffer structure. The default limit is 256 chunks.

### flush\_interval

The interval between data flushes. The suffixes "s" (seconds), "m" (minutes), and "h" (hours) can be used

### flush\_at\_shutdown

If true, queued chunks are flushed at shutdown process. The default is `false`.

### retry\_wait

The interval between retries. The suffixes "s" (seconds), "m" (minutes), and "h" (hours) can be used.

## Limitation

Caution:

`file` buffer implementation depends on the characteristics of local file system. Don't use `file` buffer on remote file system, e.g. NFS, GlusterFS, HDFS and etc. We observed major data loss by using remote file system.

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 a open source project under [Cloud Native Computing Foundation (CNCF)](https://cncf.io/). All components are available under the Apache 2 License.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fluentd.org/0.12/buffer/file.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
