Skip to content

Commit

Permalink
Merge pull request #1322 from LKummer/feat-otel-output-logs-body-key-…
Browse files Browse the repository at this point in the history
…attr

Add logs_body_key_attributes option for OpenTelemetry output plugin
  • Loading branch information
benjaminhuo authored Aug 23, 2024
2 parents a327d9b + 50637d9 commit 0ffa578
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ type OpenTelemetry struct {
// Log the response payload within the Fluent Bit log.
LogResponsePayload *bool `json:"logResponsePayload,omitempty"`
// This allows you to add custom labels to all metrics exposed through the OpenTelemetry exporter. You may have multiple of these fields.
AddLabel map[string]string `json:"addLabel,omitempty"`
*plugins.TLS `json:"tls,omitempty"`
AddLabel map[string]string `json:"addLabel,omitempty"`
// If true, remaining unmatched keys are added as attributes.
LogsBodyKeyAttributes *bool `json:"logsBodyKeyAttributes,omitempty"`
*plugins.TLS `json:"tls,omitempty"`
// Include fluentbit networking options for this output-plugin
*plugins.Networking `json:"networking,omitempty"`
}
Expand Down Expand Up @@ -91,6 +93,9 @@ func (o *OpenTelemetry) Params(sl plugins.SecretLoader) (*params.KVs, error) {
kvs.InsertStringMap(o.AddLabel, func(k, v string) (string, string) {
return "add_label", fmt.Sprintf(" %s %s", k, v)
})
if o.LogsBodyKeyAttributes != nil {
kvs.Insert("logs_body_key_attributes", fmt.Sprint(*o.LogsBodyKeyAttributes))
}
if o.TLS != nil {
tls, err := o.TLS.Params(sl)
if err != nil {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -2856,6 +2856,9 @@ spec:
logResponsePayload:
description: Log the response payload within the Fluent Bit log.
type: boolean
logsBodyKeyAttributes:
description: If true, remaining unmatched keys are added as attributes.
type: boolean
logsUri:
description: 'Specify an optional HTTP URI for the target web
server listening for logs, e.g: /v1/logs'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2856,6 +2856,9 @@ spec:
logResponsePayload:
description: Log the response payload within the Fluent Bit log.
type: boolean
logsBodyKeyAttributes:
description: If true, remaining unmatched keys are added as attributes.
type: boolean
logsUri:
description: 'Specify an optional HTTP URI for the target web
server listening for logs, e.g: /v1/logs'
Expand Down
3 changes: 3 additions & 0 deletions config/crd/bases/fluentbit.fluent.io_clusteroutputs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2856,6 +2856,9 @@ spec:
logResponsePayload:
description: Log the response payload within the Fluent Bit log.
type: boolean
logsBodyKeyAttributes:
description: If true, remaining unmatched keys are added as attributes.
type: boolean
logsUri:
description: 'Specify an optional HTTP URI for the target web
server listening for logs, e.g: /v1/logs'
Expand Down
3 changes: 3 additions & 0 deletions config/crd/bases/fluentbit.fluent.io_outputs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2856,6 +2856,9 @@ spec:
logResponsePayload:
description: Log the response payload within the Fluent Bit log.
type: boolean
logsBodyKeyAttributes:
description: If true, remaining unmatched keys are added as attributes.
type: boolean
logsUri:
description: 'Specify an optional HTTP URI for the target web
server listening for logs, e.g: /v1/logs'
Expand Down
1 change: 1 addition & 0 deletions docs/plugins/fluentbit/output/open_telemetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The OpenTelemetry plugin allows you to take logs, metrics, and traces from Fluen
| tracesUri | Specify an optional HTTP URI for the target web server listening for traces, e.g: /v1/traces | string |
| header | Add a HTTP header key/value pair. Multiple headers can be set. | map[string]string |
| logResponsePayload | Log the response payload within the Fluent Bit log. | *bool |
| logsBodyKeyAttributes | Adds unmatched keys as attributes when true. | *bool |
| addLabel | This allows you to add custom labels to all metrics exposed through the OpenTelemetry exporter. You may have multiple of these fields. | map[string]string |
| tls | | *[plugins.TLS](../tls.md) |
| networking | Include fluentbit networking options for this output-plugin | *plugins.Networking |
6 changes: 6 additions & 0 deletions manifests/setup/fluent-operator-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6793,6 +6793,9 @@ spec:
logResponsePayload:
description: Log the response payload within the Fluent Bit log.
type: boolean
logsBodyKeyAttributes:
description: If true, remaining unmatched keys are added as attributes.
type: boolean
logsUri:
description: 'Specify an optional HTTP URI for the target web
server listening for logs, e.g: /v1/logs'
Expand Down Expand Up @@ -35349,6 +35352,9 @@ spec:
logResponsePayload:
description: Log the response payload within the Fluent Bit log.
type: boolean
logsBodyKeyAttributes:
description: If true, remaining unmatched keys are added as attributes.
type: boolean
logsUri:
description: 'Specify an optional HTTP URI for the target web
server listening for logs, e.g: /v1/logs'
Expand Down
6 changes: 6 additions & 0 deletions manifests/setup/setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6793,6 +6793,9 @@ spec:
logResponsePayload:
description: Log the response payload within the Fluent Bit log.
type: boolean
logsBodyKeyAttributes:
description: If true, remaining unmatched keys are added as attributes.
type: boolean
logsUri:
description: 'Specify an optional HTTP URI for the target web
server listening for logs, e.g: /v1/logs'
Expand Down Expand Up @@ -35349,6 +35352,9 @@ spec:
logResponsePayload:
description: Log the response payload within the Fluent Bit log.
type: boolean
logsBodyKeyAttributes:
description: If true, remaining unmatched keys are added as attributes.
type: boolean
logsUri:
description: 'Specify an optional HTTP URI for the target web
server listening for logs, e.g: /v1/logs'
Expand Down

0 comments on commit 0ffa578

Please sign in to comment.