Skip to content
This repository has been archived by the owner on Aug 31, 2022. It is now read-only.

added capability to use elasticsearch datastreams #165

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pkg/kube/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ package kube

import (
"encoding/json"
corev1 "k8s.io/api/core/v1"
"strings"
"time"

corev1 "k8s.io/api/core/v1"
)

type EnhancedEvent struct {
corev1.Event `json:",inline"`
InvolvedObject EnhancedObjectReference `json:"involvedObject"`
Timestamp time.Time `json:"@timestamp"`
}

// DeDot replaces all dots in the labels and annotations with underscores. This is required for example in the
Expand Down Expand Up @@ -45,6 +47,7 @@ type EnhancedObjectReference struct {
// ToJSON does not return an error because we are %99 confident it is JSON serializable.
// TODO(makin) Is it a bad practice? It's open to discussion.
func (e *EnhancedEvent) ToJSON() []byte {
e.Timestamp = e.FirstTimestamp.Time
b, _ := json.Marshal(e)
return b
}
Expand Down