Skip to content

Commit 92dd7ff

Browse files
authored
output: stackdriver: Add documentation for labels_key (#339)
Signed-off-by: Jeff Luo <[email protected]>
1 parent ad951fa commit 92dd7ff

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

pipeline/outputs/stackdriver.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ Before to get started with the plugin configuration, make sure to obtain the pro
1616
| service\_account\_email | Account email associated to the service. Only available if **no credentials file** has been provided. | Value of environment variable _$SERVICE\_ACCOUNT\_EMAIL_ |
1717
| service\_account\_secret | Private key content associated with the service account. Only available if **no credentials file** has been provided. | Value of environment variable _$SERVICE\_ACCOUNT\_SECRET_ |
1818
| resource | Set resource type of data. Supported resource types: _k8s\_container_, _k8s\_node_, _k8s\_pod_, _global_ and _gce\_instance_. | global, gce\_instance |
19-
| k8s\_cluster\_name | The name of the cluster that the container \(node or pod based on the resource type\) is running in. If the resource type is one of the _k8s\_container_, _k8s\_node_ or _k8s\_pod_, then this field is required. | |
20-
| k8s\_cluster\_location | The physical location of the cluster that contains \(node or pod based on the resource type\) the container. If the resource type is one of the _k8s\_container_, _k8s\_node_ or _k8s\_pod_, then this field is required. | |
19+
| k8s\_cluster\_name | The name of the cluster that the container \(node or pod based on the resource type\) is running in. If the resource type is one of the _k8s\_container_, _k8s\_node_ or _k8s\_pod_, then this field is required. |
20+
| k8s\_cluster\_location | The physical location of the cluster that contains \(node or pod based on the resource type\) the container. If the resource type is one of the _k8s\_container_, _k8s\_node_ or _k8s\_pod_, then this field is required. |
21+
| labels\_key | The value of this field is used by the Stackdriver output plugin to find the related labels from jsonPayload and then extract the value of it to set the LogEntry Labels.| logging.googleapis.com/labels |
2122

2223
### Configuration File
2324

pipeline/outputs/stackdriver_special_fields.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Currently, we also support some special fields in fluent-bit:
66
| JSON log field | [LogEntry](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry) field | Logging agent function |
77
| :--- | :--- | :--- |
88
| logging.googleapis.com/operation | operation | The value of this field is also used by the Logs Viewer to group related log entries |
9+
| logging.googleapis.com/labels | labels | The value of this field should be a structured record |
10+
911

1012
## Operaiton
1113
Operation field contains additional information about a potentially long-running operation with which a log entry is associated.
@@ -127,3 +129,31 @@ the logEntry will be:
127129
...
128130
}
129131
```
132+
## Labels
133+
labels field contains specific labels in a structured entry that will be added to LogEntry labels.
134+
135+
For example, when the jsonPayload contains the subfield `logging.googleapis.com/labels`:
136+
```text
137+
jsonPayload {
138+
"logging.googleapis.com/labels": {
139+
"A": "valA",
140+
"B": "valB",
141+
"C": "valC"
142+
}
143+
...
144+
}
145+
```
146+
the stackdriver output plugin will extract labels from the subfield `logging.googleapis.com/labels` and move it up from jsonPayload to LogEntry Labels. LogEntry will be:
147+
```text
148+
{
149+
"jsonPayload": {
150+
...
151+
}
152+
"labels": {
153+
"A": "valA",
154+
"B": "valB",
155+
"C": "valC"
156+
}
157+
...
158+
}
159+
```

0 commit comments

Comments
 (0)