Skip to content

Pipeline: output: file: style #1936

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 30 additions & 28 deletions pipeline/outputs/file.md
Original file line number Diff line number Diff line change
@@ -1,73 +1,75 @@
# File

The **file** output plugin allows to write the data received through the _input_ plugin to file.
The _File_ output plugin lets you write the data received through the input plugin to file.

## Configuration Parameters
## Configuration parameters

The plugin supports the following configuration parameters:

| Key | Description | Default |
| :--- | :--- | :--- |
| Path | Directory path to store files. If not set, Fluent Bit will write the files on it's own positioned directory. note: this option was added on Fluent Bit v1.4.6 |
| File | Set file name to store the records. If not set, the file name will be the _tag_ associated with the records. |
| Format | The format of the file content. See also Format section. Default: out\_file. |
| Mkdir | Recursively create output directory if it does not exist. Permissions set to 0755. |
| Workers | The number of [workers](../../administration/multithreading.md#outputs) to perform flush operations for this output. | `1` |
| `Path` | Directory path to store files. If not set, Fluent Bit will write the files on it's own positioned directory. Available in Fluent Bit 1.4.6 and later. | _none_ |
| `File` | Set filename to store the records. If not set, the filename will be the `tag` associated with the records. | _none_ |
| `Format` | The [format](#format) of the file content. | `out_file` |
| `Mkdir` | Recursively create output directory if it doesn't exist. Permissions set to `0755`. | _none_ |
| `Workers` | The number of [workers](../../administration/multithreading.md#outputs) to perform flush operations for this output. | `1` |

## Format

### out\_file format
This plugin uses the following formats:

Output time, tag and json records. There is no configuration parameters for out\_file.
### `out_file`

Output `time`, `tag`, and `json` records. There are no configuration parameters for `out_file`.

```text
tag: [time, {"key1":"value1", "key2":"value2", "key3":"value3"}]
```

### plain format
### Plain

Output the records as JSON \(without additional `tag` and `timestamp` attributes\). There is no configuration parameters for plain format.
Output the records as JSON (without additional `tag` and `timestamp` attributes). There are no configuration parameters for plain format.

```json
{"key1":"value1", "key2":"value2", "key3":"value3"}
```

### csv format
### CSV

Output the records as csv. Csv supports an additional configuration parameter.
Output the records in CSV format. CSV mode supports an additional configuration parameter.

| Key | Description |
| :--- | :--- |
| Delimiter | The character to separate each data. Accepted values are "\t" (or "tab"), "space" or "comma". Other values are ignored and will use default silently. Default: ',' |
| `Delimiter` | The character to separate each data. Accepted values: `\t` (or `tab`), ` ` (`space`), or `,` (`comma`). Other values are ignored and will use default silently. Default: `,` |

```text
time[delimiter]"value1"[delimiter]"value2"[delimiter]"value3"
```

### ltsv format
### LTSV

Output the records as LTSV. LTSV supports an additional configuration parameter.
Output the records in LTSV format. LTSV mode supports an additional configuration parameter.

| Key | Description |
| :--- | :--- |
| Delimiter | The character to separate each pair. Default: '\t'\(TAB\) |
| Label\_Delimiter | The character to separate label and the value. Default: ':' |
| `Delimiter` | The character to separate each pair. Default: `t` (`TAB`) |
| `Label_Delimiter` | The character to separate label and the value. Default: `:` |

```text
field1[label_delimiter]value1[delimiter]field2[label_delimiter]value2\n
```

### template format
### Template

Output the records using a custom format template.

| Key | Description |
| :--- | :--- |
| Template | The format string. Default: '{time} {message}' |
| Template | The format string. Default: `{time} {message}` |

This accepts a formatting template and fills placeholders using corresponding values in a record.

For example, if you set up the configuration as below:
For example, if you set up the configuration like the following:

{% tabs %}
{% tab title="fluent-bit.yaml" %}
Expand All @@ -76,7 +78,7 @@ For example, if you set up the configuration as below:
pipeline:
inputs:
- name: mem

outputs:
- name: file
match: '*'
Expand Down Expand Up @@ -107,19 +109,19 @@ You will get the following output:
1564462620.000254 used=1045448 free=31760160 total=32805608
```

## Getting Started
## Get started

You can run the plugin from the command line or through the configuration file:
You can run the plugin from the command line or through the configuration file.

### Command Line
### Command line

From the command line you can let Fluent Bit count up a data with the following options:

```shell
fluent-bit -i cpu -o file -p path=output.txt
```

### Configuration File
### Configuration file

In your main configuration file append the following:

Expand All @@ -131,7 +133,7 @@ pipeline:
inputs:
- name: cpu
tag: cpu

outputs:
- name: file
match: '*'
Expand All @@ -153,4 +155,4 @@ pipeline:
```

{% endtab %}
{% endtabs %}
{% endtabs %}
2 changes: 2 additions & 0 deletions vale-styles/FluentBit/Headings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ exceptions:
- Collector
- Cosmos
- Crowdstrike
- CSV
- cURL
- Datadog
- Docker
Expand All @@ -49,6 +50,7 @@ exceptions:
- Kubernetes
- LaunchDarkly
- Linux
- LTSV
- macOS
- Marketplace
- MongoDB
Expand Down