resmoio / kubernetes-event-exporter

Export Kubernetes events to multiple destinations with routing and filtering
Apache License 2.0
753 stars 149 forks source link

feat: Allow using templates in indexFormat for OpenSearch sink #181

Open jarnfast opened 4 months ago

jarnfast commented 4 months ago

This PR adds the capability to use templates when constructing the indexFormat for OpenSearch sinks.

The change is backwards compatible with the existing time formatting directives - this is ensured by the added tests.

Given an example configuration:

receivers:
  - name: "by-namespace"
    opensearch:
      hosts:
        - http://localhost:9200
      indexFormat: "kube-events-{{ .InvolvedObject.Namespace }}-{2006-01-02}"

An event originating from kube-system will end up in a index named kube-events-kube-system-<go formatted date>.

Closes #155