Skip to content

Commit

Permalink
feat: allow running otel log collector and fluent bit side by side
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikołaj Świątek committed Aug 29, 2022
1 parent e22e06c commit ee963d0
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 4 deletions.
24 changes: 23 additions & 1 deletion deploy/docs/opentelemetry_collector.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ fluent-bit:
enabled: false
```

> **NOTE** Fluent Bit must be disabled for OpenTelemetry Collector to be enabled, they are mutually exclusive.
> **NOTE** Normally, Fluent Bit must be disabled for OpenTelemetry Collector to be enabled. This restriction can be lifted, see [here](#running-otelcol-and-fluent-bit-side-by-side).

For metadata enrichment, it can be enabled by setting:

Expand Down Expand Up @@ -145,6 +145,28 @@ sumologic:
- docker.service
```

### Running otelcol and Fluent Bit side by side

Normally, enabling both Otelcol and Fluent-Bit for log collection will fail with an error. The reason for this is that doing so naively results
in each log line being delivered twice to Sumo Logic, incurring twice the cost without any benefit. However, there are reasons to do this; for example
it makes for a smoother and less risky migration. Advanced users may also want to pin the different collectors to different Node groups.

Because of this, we've included a way to allow running otelcol and Fluent Bit side by side. The minimal configuration enabling this is:

```yaml
sumologic:
logs:
collector:
otelcol:
enabled: true
allowSideBySide: true
fluent-bit:
enabled: true
```

> **WARNING** This will cause each log line to be ingested twice, with all the associated costs.

## Persistence

The persistence for OpenTelemetry Collector can be configured in [`values.yaml`][values] by making changes under the `metadata.persistence`:
Expand Down
3 changes: 2 additions & 1 deletion deploy/helm/sumologic/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -1384,7 +1384,8 @@ Example Usage:
{{- if kindIs "invalid" $fluentBitEnabled -}}
{{- $fluentBitEnabled = true -}}
{{- end -}}
{{- if and $enabled $fluentBitEnabled -}}
{{- $sideBySideAllowed := .Values.sumologic.logs.collector.allowSideBySide -}}
{{- if and $enabled $fluentBitEnabled (not $sideBySideAllowed) -}}
{{- fail "Fluent-Bit and Otel log collector can't be enabled at the same time. Set either `fluent-bit.enabled` or `sumologic.logs.collector.otelcol.enabled` to false" -}}
{{- end -}}
{{ $enabled }}
Expand Down
4 changes: 4 additions & 0 deletions deploy/helm/sumologic/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,10 @@ sumologic:
otelcol:
enabled: false

## Allow running otel and Fluent-Bit side by side. This will result in duplicated
## logs being ingested. Only enabled this if you're **certain** it's what you want.
allowSideBySide: false

multiline:
enabled: true
first_line_regex: "^\\[?\\d{4}-\\d{1,2}-\\d{1,2}.\\d{2}:\\d{2}:\\d{2}"
Expand Down
6 changes: 4 additions & 2 deletions tests/integration/values/values_helm_otelcol_logs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ sumologic:
metadata:
provider: otelcol
collector:
enabled: true
otelcol:
enabled: true
allowSideBySide: true

metrics:
enabled: false

# We're using otelcol instead
fluent-bit:
enabled: false
enabled: true

fluentd:
events:
Expand Down

0 comments on commit ee963d0

Please sign in to comment.