-
Notifications
You must be signed in to change notification settings - Fork 635
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
add black list to aviod take too much efforts to translate in file log watcher #961
add black list to aviod take too much efforts to translate in file log watcher #961
Conversation
Hi @smileusd. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Do you always know what pattern to skip in the log? Can you provide a sample config file with the blacklist for your target use case? /ok-to-test |
if s.cfg.BlackList == nil || len(s.cfg.BlackList) == 0 { | ||
return false | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this adds much value. Range should be able to handle nil or empty slices.
if s.cfg.BlackList == nil || len(s.cfg.BlackList) == 0 { | |
return false | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
// Skip the black list by simple filter to avoid running more efforts in regex | ||
BlackList []string `json:"blackList,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Skip the black list by simple filter to avoid running more efforts in regex | |
BlackList []string `json:"blackList,omitempty"` | |
// Skip the log lines containing any of the strings in the list to avoid running unnecessary regex. | |
SkipList []string `json:"skipList,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
In our cluster, the users deploy the audit beat pod and record the log with all files changed in /var/log/messages. So we skip log simply contains the "audit:" and "audit[" .
There is 95% useless logs in NPD impact the performance |
c7b9f37
to
2b5c836
Compare
/test pull-npd-e2e-test |
/lgtm |
@@ -116,6 +116,9 @@ func (s *filelogWatcher) watchLoop() { | |||
} | |||
line = buffer.String() | |||
buffer.Reset() | |||
if s.filterSkipList(line) { | |||
continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add some test for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -36,6 +36,8 @@ type WatcherConfig struct { | |||
// PluginConfig is a key/value configuration of a plugin. Valid configurations | |||
// are defined in different log watcher plugin. | |||
PluginConfig map[string]string `json:"pluginConfig,omitempty"` | |||
// Skip the log lines containing any of the strings in the list to avoid running unnecessary regex. | |||
SkipList []string `json:"skipList,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a sample config file in https://github.com/kubernetes/node-problem-detector/tree/master/config to illustrate how to use this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also squash the commits?
config/docker-monitor-filelog.json
Outdated
@@ -9,6 +9,7 @@ | |||
"lookback": "5m", | |||
"bufferSize": 10, | |||
"source": "docker-monitor", | |||
"skipList": [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to add empty list in existing files. We need to make sure when it is missing, those files still work for backward compatibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
config/kernel-monitor-filelog.json
Outdated
@@ -9,6 +9,7 @@ | |||
"lookback": "5m", | |||
"bufferSize": 10, | |||
"source": "kernel-monitor", | |||
"skipList": [ " audit:", " audit[" ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove from this file and add a new json file with this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
BTW, we plan to make a new release this week. If you can get the PR ready in a day or two, we can include it in the upcoming release. Otherwise, it can wait for the next release. /retest |
81d34d2
to
3a386a6
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hakman, smileusd, wangzhen127 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This pr is to add black list in file log watcher to skip the translat which take too much overhead in cpu when log flush outburst #960