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: pipeline/outputs/loki.md
+43Lines changed: 43 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,7 @@ Be aware there is a separate Golang output plugin provided by [Grafana](https://
19
19
| tenant\_id | Tenant ID used by default to push logs to Loki. If omitted or empty it assumes Loki is running in single-tenant mode and no X-Scope-OrgID header is sent. ||
20
20
| labels | Stream labels for API request. It can be multiple comma separated of strings specifying `key=value` pairs. In addition to fixed parameters, it also allows to add custom record keys \(similar to `label_keys` property\). More details in the Labels section. | job=fluentbit |
21
21
| label\_keys | Optional list of record keys that will be placed as stream labels. This configuration property is for records key only. More details in the Labels section. ||
22
+
| label\_map\_path | Specify the label map file path. The file defines how to extract labels from each record. More details in the Labels section. ||
22
23
| remove\_keys | Optional list of keys to remove. ||
23
24
| drop\_single\_key | If set to true and after extracting labels only a single key remains, the log line sent to Loki will be the value of that key in line\_format. | off |
24
25
| line\_format | Format to use when flattening the record to a log line. Valid values are `json` or `key_value`. If set to `json`, the log line sent to Loki will be the Fluent Bit record dumped as JSON. If set to `key_value`, the log line will be each item in the record concatenated together \(separated by a single space\) in the format. | json |
@@ -95,6 +96,48 @@ The following configuration examples generate the same Stream Labels:
95
96
label_keys $sub['stream']
96
97
```
97
98
99
+
the above configuration accomplish the same than this one:
100
+
101
+
```text
102
+
[OUTPUT]
103
+
name loki
104
+
match *
105
+
labels job=fluentbit, $sub['stream']
106
+
```
107
+
108
+
both will generate the following Streams label:
109
+
110
+
```text
111
+
job="fluentbit", stream="stdout"
112
+
```
113
+
114
+
### Using the `label_map_path` property
115
+
116
+
The configuration property `label_map_path` is to read a JSON file that defines how to extract labels from each record.
117
+
118
+
The file should contain a JSON object. Each keys define how to get label value from a nested record. Each values are used as label names.
119
+
120
+
The following configuration examples generate the same Stream Labels:
121
+
122
+
map.json:
123
+
```json
124
+
{
125
+
"sub": {
126
+
"stream": "stream"
127
+
}
128
+
}
129
+
```
130
+
131
+
The following configuration examples generate the same Stream Labels:
132
+
133
+
```text
134
+
[OUTPUT]
135
+
name loki
136
+
match *
137
+
label_map_path /path/to/map.json
138
+
```
139
+
140
+
98
141
the above configuration accomplish the same than this one:
0 commit comments