Skip to content

Commit 00b9632

Browse files
authored
Merge pull request #247 from fluent/1.0-crlf-newline-choice
1.0: formatter: CRLF newline choice handling documentation
2 parents a398301 + 506f321 commit 00b9632

File tree

8 files changed

+152
-3
lines changed

8 files changed

+152
-3
lines changed

plugins/formatter/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ how to develop a custom formatter.
6767
- [`msgpack`](/plugins/formatter/msgpack.md)
6868
- [`hash`](/plugins/formatter/hash.md)
6969
- [`single_value`](/plugins/formatter/single_value.md)
70+
- [`tsv`](/plugins/formatter/tsv.md)
7071

7172

7273
## List of Output/Filter Plugins with Formatter Support

plugins/formatter/csv.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
The `csv` formatter plugin output an event as CSV.
44

55
```text
6-
"value1"[delimiter]"value2"[delimiter]"value3"\n
6+
"value1"[delimiter]"value2"[delimiter]"value3"[newline]
77
```
88

99

@@ -70,16 +70,32 @@ record: {"host":"192.168.0.1","size":777,"method":"PUT"}
7070

7171
This incoming event is formatted to:
7272

73+
In non-Windows:
74+
7375
```text
7476
"192.168.0.1","PUT"\n
7577
```
7678

79+
In Windows:
80+
81+
```text
82+
"192.168.0.1","PUT"\r\n
83+
```
84+
7785
With `force_quotes false`, the result is:
7886

87+
In non-Windows:
88+
7989
```text
8090
192.168.0.1,PUT\n
8191
```
8292

93+
In Windows:
94+
95+
```text
96+
192.168.0.1,PUT\r\n
97+
```
98+
8399

84100
------------------------------------------------------------------------
85101

plugins/formatter/hash.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ By default, `hash` formatter result doesn't contain `tag` and `time` fields.
1919

2020
Adds `\n` to the result.
2121

22+
### `newline`
23+
24+
| type | default | version |
25+
|:-----|:------------------------------------------------|:--------|
26+
| enum | `lf (for non-Windows)` or `crlf (for Windows)` | 1.11.5 |
27+
28+
29+
Specify newline characters.
2230

2331
## Example
2432

plugins/formatter/json.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ By default, `json` formatter result doesn't contain `tag` and `time` fields.
1919

2020
Adds `\n` to the result.
2121

22+
### `newline`
23+
24+
| type | default | version |
25+
|:-----|:------------------------------------------------|:--------|
26+
| enum | `lf (for non-Windows)` or `crlf (for Windows)` | 1.11.5 |
27+
28+
29+
Specify newline characters.
2230

2331
## Example
2432

plugins/formatter/ltsv.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
The `ltsv` formatter plugin output an event as [LTSV](http://ltsv.org).
44

55
```text
6-
field1[label_delimiter]value1[delimiter]field2[label_delimiter]value2\n
6+
field1[label_delimiter]value1[delimiter]field2[label_delimiter]value2[newline]
77
```
88

99

@@ -39,6 +39,14 @@ Delimiter for the key-value field.
3939

4040
Adds `\n` to the result.
4141

42+
### `newline`
43+
44+
| type | default | version |
45+
|:-----|:------------------------------------------------|:--------|
46+
| enum | `lf (for non-Windows)` or `crlf (for Windows)` | 1.11.5 |
47+
48+
49+
Specify newline characters.
4250

4351
## Example
4452

@@ -50,10 +58,18 @@ record: {"host":"192.168.0.1","size":777,"method":"PUT"}
5058

5159
This incoming event is formatted to:
5260

61+
In non-Windows:
62+
5363
```text
5464
host:192.168.0.1\tsize:777\tmethod:PUT\n
5565
```
5666

67+
In Windows:
68+
69+
```text
70+
host:192.168.0.1\tsize:777\tmethod:PUT\r\n
71+
```
72+
5773

5874
------------------------------------------------------------------------
5975

plugins/formatter/out_file.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ The `out_file` formatter plugin outputs time, tag and json record
44
separated by a delimiter.
55

66
```text
7-
time[delimiter]tag[delimiter]record\n
7+
time[delimiter]tag[delimiter]record[newline]
88
```
99

1010
This format is a default format of `out_file` plugin.
@@ -62,6 +62,14 @@ Overwrites the default value in this plugin.
6262

6363
Overwrites the default value in this plugin.
6464

65+
### `newline`
66+
67+
| type | default | version |
68+
|:-----|:------------------------------------------------|:--------|
69+
| enum | `lf (for non-Windows)` or `crlf (for Windows)` | 1.11.5 |
70+
71+
72+
Specify newline characters.
6573

6674
## Example
6775

plugins/formatter/single_value.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ Adds `\n` to the result. If there is a trailing `\n` already, set it `false`.
3030

3131
The value of this field is outputted.
3232

33+
### `newline`
34+
35+
| type | default | version |
36+
|:-----|:------------------------------------------------|:--------|
37+
| enum | `lf (for non-Windows)` or `crlf (for Windows)` | 1.11.5 |
38+
39+
40+
Specify newline characters.
3341

3442
## Example
3543

@@ -41,10 +49,18 @@ record: {"message":"Hello from Fluentd!"}
4149

4250
This incoming event is formatted to:
4351

52+
In non-Windows:
53+
4454
```text
4555
Hello from Fluentd!\n
4656
```
4757

58+
In Windows:
59+
60+
```text
61+
Hello from Fluentd!\r\n
62+
```
63+
4864

4965
------------------------------------------------------------------------
5066

plugins/formatter/tsv.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# `tsv` Formatter Plugin
2+
3+
The `tsv` formatter plugin converts an event as TSV.
4+
5+
```text
6+
value1[delimiter]value2[newline]
7+
```
8+
9+
10+
## Parameters
11+
12+
- [Common Parameters](/configuration/plugin-common-parameters.md)
13+
- [Format section configurations](/configuration/format-section.md)
14+
15+
### `keys`
16+
17+
| type | default | version |
18+
|:----------------|:---------|:--------|
19+
| array of string | `nil` | 0.14.0 |
20+
21+
Specifies the output fields. It is a required parameter.
22+
23+
### `delimiter`
24+
25+
| type | default | version |
26+
|:-------|:-----------|:--------|
27+
| string | `\t` (TAB) | 0.14.0 |
28+
29+
Delimiter for the fields.
30+
31+
### `add_newline`
32+
33+
| type | default | version |
34+
|:-----|:--------|:--------|
35+
| bool | `true` | 0.14.12 |
36+
37+
Adds `\n` to the result.
38+
39+
### `newline`
40+
41+
| type | default | version |
42+
|:-----|:------------------------------------------------|:--------|
43+
| enum | `lf (for non-Windows)` or `crlf (for Windows)` | 1.11.5 |
44+
45+
46+
Specify newline characters.
47+
48+
## Example
49+
50+
```text
51+
tag: app.event
52+
time: 1362020400
53+
record: {"host":"192.168.0.1","size":777,"method":"PUT"}
54+
```
55+
56+
This incoming event is formatted to:
57+
58+
In non-Windows:
59+
60+
```text
61+
192.168.0.1\t777\tPUT\n
62+
```
63+
64+
In non-Windows:
65+
66+
```text
67+
192.168.0.1\t777\tPUT\r\n
68+
```
69+
70+
------------------------------------------------------------------------
71+
72+
If this article is incorrect or outdated, or omits critical information, please
73+
[let us know](https://github.com/fluent/fluentd-docs-gitbook/issues?state=open).
74+
[Fluentd](http://www.fluentd.org/) is an open-source project under
75+
[Cloud Native Computing Foundation (CNCF)](https://cncf.io/). All components are
76+
available under the Apache 2 License.

0 commit comments

Comments
 (0)