Skip to content

Instantly share code, notes, and snippets.

@stefanandres
Created January 20, 2022 15:01
Show Gist options
  • Save stefanandres/5ef5947b29dfa85019ea2a2a58428eb7 to your computer and use it in GitHub Desktop.
Save stefanandres/5ef5947b29dfa85019ea2a2a58428eb7 to your computer and use it in GitHub Desktop.
kubernetes events to loki
helmDefaults:
wait: true
timeout: 1200
createNamespace: false
repositories:
- name: bitnami
url: https://charts.bitnami.com/bitnami
releases:
- name: kubernetes-event-exporter
namespace: monitoring
chart: bitnami/kubernetes-event-exporter
version: 1.3.1
values:
- values-kubernetes-event-exporter.yaml
config:
logLevel: error
logFormat: json
receivers:
- name: "loki"
webhook:
endpoint: "http://loki:3100/loki/api/v1/push"
headers:
Content-Type: application/json
User-Agent: kubernetes-event-exporter
layout:
streams:
- stream:
job: 'kubernetes-events'
type: '{{ .Type }}'
reason: '{{ .Reason }}'
name: '{{ .InvolvedObject.Name }}'
namespace: '{{ .InvolvedObject.Namespace }}'
kind: '{{ .InvolvedObject.Kind }}'
host: '{{ .Source.Host }}'
component: '{{ .Source.Component }}'
values:
- - "{{ .GetTimestampMs }}000000"
- 'level={{ lower .Type | replace "normal" "notice" }} namespace={{ .InvolvedObject.Namespace }} kind={{ .InvolvedObject.Kind }} name={{ .InvolvedObject.Name }} reason={{ .Reason }} message={{ quote .Message }}'
route:
routes:
- match:
- receiver: "loki"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment