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/stackdriver.md
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -157,6 +157,15 @@ For instance, for a K8s resource type, `resource_labels` can be used in tandem w
157
157
```
158
158
159
159
`resource_labels` also supports validation for required labels based on the input resource type. This allows fluent-bit to check if all specified labels are present for a given configuration before runtime. If validation is not currently supported for a resource type that you would like to use this API with, we encourage you to open a pull request for it. Adding validation for a new resource type is simple - all that is needed is to specify the resources associated with the type alongside the required labels [here](https://github.com/fluent/fluent-bit/blob/master/plugins/out_stackdriver/stackdriver_resource_types.c#L27).
160
+
161
+
## Log Name
162
+
163
+
By default, the plugin will write to the following log name:
164
+
```
165
+
/projects/<project ID>/logs/<log tag>
166
+
```
167
+
You may be in a scenario where being more specific about the log name is important (for example [integration with Log Router rules](https://cloud.google.com/logging/docs/routing/overview) or [controlling cardinality of log based metrics]((https://cloud.google.com/logging/docs/logs-based-metrics/troubleshooting#too-many-time-series))). You can control the log name directly on a per-log basis by using the [`logging.googleapis.com/logName` special field][StackdriverSpecialFields]. You can configure a `log_name_key` if you'd like to use something different than `logging.googleapis.com/logName`, i.e. if the `log_name_key` is set to `mylognamefield` will extract the log name from `mylognamefield` in the log.
Copy file name to clipboardExpand all lines: pipeline/outputs/stackdriver_special_fields.md
+11-9Lines changed: 11 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ Currently, we support some special fields in fluent-bit for setting fields on th
26
26
| JSON log field | Description |
27
27
| :--- | :--- |
28
28
|`logging.googleapis.com/projectId`| Changes the project ID that this log will be written to. Ensure that you are authenticated to write logs to this project. |
29
-
|`logging.googleapis.com/local_resource_id`| Overrides the [configured `local_resource_id`](). |
29
+
|`logging.googleapis.com/local_resource_id`| Overrides the [configured `local_resource_id`](./stackdriver.md#resource-labels). |
30
30
31
31
## Using Special Fields
32
32
@@ -61,7 +61,7 @@ Adding special fields to logs is best done through the [`modify` filter](https:/
61
61
62
62
For special fields with simple types (with the exception of the [`logging.googleapis.com/insertId` field](#insert-id)), they will follow this pattern (demonstrated with the `logging.googleapis.com/logName` field):
63
63
64
-
**1. If the special field matches the type, it will be moved to the corresponding LogEntry field.** For example:
64
+
1. If the special field matches the type, it will be moved to the corresponding LogEntry field. For example:
65
65
```text
66
66
{
67
67
"logging.googleapis.com/logName": "my_log"
@@ -79,7 +79,7 @@ the logEntry will be:
79
79
}
80
80
```
81
81
82
-
**2. If the field is non-empty but an invalid, it will be left in the jsonPayload.** For example:
82
+
2. If the field is non-empty but an invalid, it will be left in the jsonPayload. For example:
83
83
```text
84
84
{
85
85
"logging.googleapis.com/logName": 12345
@@ -132,7 +132,7 @@ The `timestampSecond` and `timestampNano` fields don't map directly to the `time
132
132
133
133
For special fields that expect the format of a proto type from the `LogEntry` (with the exception of the `logging.googleapis.com/monitored_resource` field) will follow this pattern (demonstrated with the `logging.googleapis.com/operation` field):
134
134
135
-
**If any subfields of the proto are empty or in incorrect type, the plugin will set these subfields empty.** For example:
135
+
If any subfields of the proto are empty or in incorrect type, the plugin will set these subfields empty. For example:
136
136
```text
137
137
{
138
138
"logging.googleapis.com/operation": {
@@ -158,7 +158,7 @@ the logEntry will be:
158
158
}
159
159
```
160
160
161
-
**If the field itself is not a map, the plugin will leave this field untouched.** For example:
161
+
If the field itself is not a map, the plugin will leave this field untouched. For example:
**If there are extra subfields, the plugin will add the recognized fields to the corresponding field in the LogEntry, and preserve the extra subfields in jsonPayload.** For example:
179
+
If there are extra subfields, the plugin will add the recognized fields to the corresponding field in the LogEntry, and preserve the extra subfields in jsonPayload. For example:
180
180
```text
181
181
{
182
182
"logging.googleapis.com/operation": {
@@ -221,7 +221,7 @@ The `logging.googleapis.com/monitored_resource` field is parsed in a special way
221
221
222
222
The `type` field from the [`MonitoredResource` proto]() is not parsed out of the special field. It is read from the [`resource` plugin configuration option](https://docs.fluentbit.io/manual/pipeline/outputs/stackdriver#configuration-parameters). If it is supplied in the `logging.googleapis.com/monitored_resource` special field, it will not be recognized.
223
223
224
-
The `labels` field is expected to be an `object<string, string>`. If any fields have a value that is not a string, the value will be ignored and **not preserved**. The plugin will log an error and drop the field.
224
+
The `labels` field is expected to be an `object<string, string>`. If any fields have a value that is not a string, the value will be ignored and not preserved. The plugin will log an error and drop the field.
225
225
226
226
If no valid `labels` field is found, or if all of entries in the `labels` object provided are invalid, the `logging.googleapis.com/monitored_resource` field is dropped in favour of automatically setting resource labels using other available information based on the configured `resource` type.
227
227
@@ -253,7 +253,8 @@ If one of the following JSON timestamp representations is present in a structure
253
253
254
254
Without time-related fields, the plugin will set the current time as timestamp.
0 commit comments