Skip to content

Commit b106538

Browse files
committed
chore(plugin): only collect drycc controller logs
1 parent 1f61ae8 commit b106538

1 file changed

Lines changed: 5 additions & 15 deletions

File tree

plugin/out_drycc.go

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import (
88
"sort"
99
"strings"
1010

11-
"golang.org/x/exp/slices"
12-
1311
"github.com/fluent/fluent-bit-go/output"
1412
redis "github.com/redis/go-redis/v9"
1513
)
@@ -166,21 +164,13 @@ func toTimestamp(ts interface{}) string {
166164

167165
func checkRecord(record map[interface{}]interface{}) bool {
168166
if kubernetes, ok := record["kubernetes"].(map[interface{}]interface{}); ok {
169-
if labels, ok := kubernetes["labels"].(map[interface{}]interface{}); ok {
170-
// application logs deployed by drycc
171-
heritage := fmt.Sprintf("%s", labels["heritage"])
172-
namespace := fmt.Sprintf("%s", kubernetes["namespace_name"])
173-
if !slices.Contains(ExcludeNamespaces, namespace) && heritage == "drycc" && labels["app"] != nil {
167+
// drycc controller
168+
container := fmt.Sprintf("%s", kubernetes["container_name"])
169+
if ok && strings.HasPrefix(container, ControllerName) {
170+
log := fmt.Sprintf("%s", record["log"])
171+
if ok && len(ControllerRegex.FindStringSubmatch(log)) > 0 {
174172
return true
175173
}
176-
// drycc controller
177-
container := fmt.Sprintf("%s", kubernetes["container_name"])
178-
if ok && strings.HasPrefix(container, ControllerName) {
179-
log := fmt.Sprintf("%s", record["log"])
180-
if ok && len(ControllerRegex.FindStringSubmatch(log)) > 0 {
181-
return true
182-
}
183-
}
184174
}
185175
}
186176
return false

0 commit comments

Comments
 (0)