Skip to content

Commit

Permalink
feat: refactor event collection configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikołaj Świątek committed Nov 16, 2022
1 parent 741408c commit 0d6fb49
Show file tree
Hide file tree
Showing 23 changed files with 129 additions and 104 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- chore(kube-prometheus-stack): update kube-prometheus-stack chart to 39.11.0 [#2446]
- feat(metrics)!: disable Thanos by default [#2514]
- fix(fluentd): Removing PodSecurityPolicy for fluentd [#2605]
- feat!: refactor event collection configuration [#2444]

### Changed

Expand Down Expand Up @@ -65,6 +66,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[#2600]: https://github.com/SumoLogic/sumologic-kubernetes-collection/pull/2600
[#2605]: https://github.com/SumoLogic/sumologic-kubernetes-collection/pull/2605
[#2611]: https://github.com/SumoLogic/sumologic-kubernetes-collection/pull/2611
[#2444]: https://github.com/SumoLogic/sumologic-kubernetes-collection/pull/2444
[Unreleased]: https://github.com/SumoLogic/sumologic-kubernetes-collection/compare/v2.17.0...main
[telegraf_operator_comapare_1.3.5_and_1.3.10]: https://github.com/influxdata/helm-charts/compare/telegraf-operator-1.3.5...telegraf-operator-1.3.10
[cert-manager-1.4]: https://github.com/cert-manager/cert-manager/releases/tag/v1.4.0
Expand Down
62 changes: 51 additions & 11 deletions deploy/docs/collecting-kubernetes-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,7 @@ You can collect Kubernetes events from the Kubernetes API server and send them t
This feature is enabled by default.
To disable it, set the `sumologic.events.enabled` property to `false`.

Event collection is performed by the provider specified in `sumologic.events.provider`. This can be either `fluentd` for Fluentd (which is currently the default) or `otelcol` for OpenTelemetry Collector (which will be the default in a future release).
You can switch the provider by setting the property:

```yaml
sumologic:
events:
provider: otelcol
```
Both providers work in the same way: they request all Kubernetes events from the Kubernetes API server.
The event collector collects events by requesting all Kubernetes events from the Kubernetes API server.
Note that the resource API used is [core v1][event_v1_core] and not [events.k8s.io/v1][event_events_k8s_io].
The events are sent as logs in their original JSON format to Sumo Logic.

Expand Down Expand Up @@ -63,7 +54,54 @@ Example Kubernetes event:

## Configuration

To configure event collection, see the following sections of the [values.yaml][values_yaml] file, depending on the provider used:
Event collection configuration can be found under the `sumologic.events` key of the [values.yaml][values_yaml] file.

### Setting source name and category

It's possible to customize the [source name][source_name] and [category][source_category] for events:

```yaml
sumologic:
events:
sourceName: myEventSource
sourceCategory: myCustomSourceCategory
```
### Customizing persistence
By default, the event collector provisions and uses a Kubernetes PersistentVolume to persist some information over service restarts.
In particular, the collector remembers the most recently processed Event this way, thus avoiding having to reprocess past Events
after restart. The Persistent Volume is also used to buffer Event data if the remote destination is inaccessible.
Persistence can be customized via the `sumologic.events.persistence` section:

```yaml
sumologic:
events:
persistence:
size: 10Gi
path: /var/lib/storage/events
accessMode: ReadWrite
```

#### Disabling persistence

Persistence can be disabled by setting `sumologic.events.persistence.enabled` to `false`. Keep in mind that doing so will cause
either duplication or data loss whenever the collector is restarted. By default, the collector reads Events 1 minute into the past
from its start time.

### Configuring the event provider

Event collection is performed by the provider specified in `sumologic.events.provider`. This can be either `fluentd` for Fluentd (which is currently the default) or `otelcol` for OpenTelemetry Collector (which will be the default in a future release).
You can switch the provider by setting the property:

```yaml
sumologic:
events:
provider: otelcol
```

To change provider-specific configuration, see the following sections of the [values.yaml][values_yaml] file, depending on the provider used:

- `fluentd.events` for Fluentd provider (the default)
- `otelevents` for OpenTelemetry Collector provider
Expand All @@ -84,3 +122,5 @@ sumologic:
[event_events_k8s_io]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#event-v1-events-k8s-io
[values_yaml]: ../helm/sumologic/values.yaml
[otelcol_config]: ./opentelemetry_collector.md#kubernetes-events
[source_category]: https://help.sumologic.com/03Send-Data/Sources/04Reference-Information-for-Sources/Metadata-Naming-Conventions#Source_Categories
[source_name]: https://help.sumologic.com/03Send-Data/Sources/04Reference-Information-for-Sources/Metadata-Naming-Conventions#Source_Name
12 changes: 2 additions & 10 deletions deploy/docs/opentelemetry_collector.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ sumologic:
otelcol:
enabled: true
allowSideBySide: true
fluent-bit:
enabled: true
```
Expand Down Expand Up @@ -570,16 +570,8 @@ sumologic:
provider: otelcol
```

Currently the OT configuration directly uses the following Fluentd configuration values:

- `fluentd.events.sourceCategory` to specify the [source category][source_category] for the event logs
- `fluentd.events.sourceName` to specify the [source name][source_name] for the event logs

For configurations that don't modify `sumologic.fluentd.events.overrideOutputConf`, this should be enough. See the configuration
options under `otelevents` in [values.yaml](../helm/sumologic/values.yaml).

[source_category]: https://help.sumologic.com/docs/send-data/reference-information/metadata-naming-conventions#source-categories
[source_name]: https://help.sumologic.com/docs/send-data/reference-information/metadata-naming-conventions#source-name
options under `otelevents` in [values.yaml](../helm/sumologic/values.yaml) for OT-specific configuration..

### Customizing OpenTelemetry Collector configuration

Expand Down
Loading

0 comments on commit 0d6fb49

Please sign in to comment.