Skip to content

Allow filtering out normal events #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from 3 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
11 changes: 11 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package main

import (
"encoding/json"
"flag"
"fmt"
"log"
"os"

Expand All @@ -12,7 +14,13 @@ import (
"k8s.io/client-go/tools/clientcmd"
)

var (
ignoreNormal = flag.Bool("ignore_normal", false, "ignore events of the normal type, they can be noisy")
)

func main() {
flag.Parse()

loggerApplication := log.New(os.Stderr, "", log.LstdFlags)
loggerEvent := log.New(os.Stdout, "", 0)

Expand Down Expand Up @@ -51,6 +59,9 @@ func main() {
0,
cache.ResourceEventHandlerFuncs{
AddFunc: func(obj interface{}) {
if (*ignoreNormal && obj.(*corev1.Event).Type == corev1.EventTypeNormal) {
return
}
j, _ := json.Marshal(obj)
loggerEvent.Printf("%s\n", string(j))
},
Expand Down