Commit Graph
62 Commits
Author SHA1 Message Date
Ciprian Hacman a20306e6a1 fix(logwatchers/kmsg): don't close the old parser twice when Stop() interrupts a restart
The restart path closes the failed parser before retrying. If stopping
is signaled during the retry wait, watchLoop's deferred cleanup closed
the same parser again, logging a spurious 'file already closed' error
at shutdown. Clear the reference after closing and nil-check the defer.
2026-07-11 10:28:27 +03:00
Ciprian Hacman b77c1eb03f fix(logwatchers/kmsg): don't block Stop() when the log channel is full
The log monitor stops draining logCh before calling watcher.Stop(), so
with a full channel (e.g. a kmsg burst at shutdown) watchLoop blocked
on the send forever, never called tomb.Done(), and Stop() hung.
Select on tomb.Stopping() alongside the send.
2026-07-11 10:27:59 +03:00
Ciprian Hacman 187d4d30d6 fix(logwatchers/kmsg): rate-limit parser restarts to prevent hot loop
If the restarted parser's channel closes again right away (reads keep
failing on the reopened /dev/kmsg), the watcher restarts in a tight
loop with no delay, spinning a CPU core and flooding the logs
(measured 37k restarts in 200ms). Delay the first attempt when the
previous restart was less than retryDelay ago.
2026-07-11 10:27:37 +03:00
Ciprian Hacman 3d516d9213 test(logwatchers/kmsg): inject parser factory for testability and cover restart/stop 2026-04-11 08:37:32 +03:00
Kubernetes Prow RobotandGitHub ea22add87e Merge pull request #1259 from hakman/kmsg-duplicate-message
fix(logwatchers/kmsg): prevent duplicate message replay after restart
2026-04-11 00:18:18 +05:30
Ciprian Hacman b3379b0d23 fix(logwatchers/kmsg): prevent duplicate message replay after restart 2026-04-10 16:06:32 +03:00
Ciprian Hacman 78f76b2778 fix(logwatchers/kmsg): don't close parser from Stop()
Closing the parser in Stop() triggers kmsgparser's read goroutine to
close its output channel, which made watchLoop take the restart path
(added in #1192) during intentional shutdown. Leave parser cleanup to
watchLoop's defer, which is the single owner of the parser lifecycle.
2026-04-10 15:45:22 +03:00
Arjun Raman 748fecd95d Remove opt-in knob for restarting kmsg parser and simplify retry loop 2026-03-24 11:20:14 -07:00
Arjun RamanandGitHub c530d1f701 Remove log message for restart on error
Removed log message for disabled restart on error.
2025-12-18 12:29:26 -08:00
Arjun Raman f1bdf8d30e Restart kmsg on error 2025-12-11 15:51:24 -08:00
Ciprian Hacman 2e69489cc6 Update golangci-lint to v2.6.2 2025-11-29 10:42:18 +02:00
Sergey Kanzhelev 3e64800668 enabled a few more linter rules 2025-09-11 18:47:20 +00:00
Sergey Kanzhelev 0ce333bbc5 enabled and fixed the errcheck linter rule 2025-09-10 21:45:46 +00:00
Sergey Kanzhelev a3a4504706 fix the static ckeck linter issues 2025-09-08 19:10:28 +00:00
Sergey Kanzhelev 75bf501888 format imports 2025-08-13 16:56:32 +00:00
googs1025 f5433f460d feature: add custom message for systemlogmonitor rule 2024-12-23 19:45:29 +08:00
tashen 3a386a659e add skip list to aviod take too much efforts to translate in file log watcher 2024-10-16 10:56:15 +08:00
Ciprian Hacman fdd522a951 Update github.com/coreos/go-systemd to v22.5.0 2023-09-20 07:13:42 +03:00
Ciprian Hacman 65e4aa3c5e Remove dependency on code.cloudfoundry.org/clock 2023-09-19 12:50:29 +03:00
Ciprian Hacman 5210373640 Init useful flags for klog/v2 2023-09-17 11:00:42 +03:00
Manuel RügerandCiprian Hacman e43459d86d Move glog/klog logging to klog/v2 2023-09-17 08:57:33 +03:00
Ciprian Hacman f58f6cd208 Update tests to run also on macOS 2023-09-11 19:25:59 +03:00
Ciprian Hacman 2077606ba3 Remove direct dependency on google/cadvisor 2023-09-08 15:28:25 +03:00
Fan Shang Xiang adbe770d74 replace k8s.io/apimachinery/pkg/util/clock with k8s.io/utils/clock 2023-08-31 06:27:32 +00:00
Kubernetes Prow RobotandGitHub 6b538a5d4e Merge pull request #768 from testwill/pkg-import
chore: pkg imported more than once
2023-06-25 22:07:08 -07:00
Kubernetes Prow RobotandGitHub e6fbdd434a Merge pull request #760 from MartinForReal/master
bump k8s.io dependencies to 1.17.2
2023-06-25 21:41:16 -07:00
guoguangwu da422bb452 chore: pkg imported more than once 2023-06-21 14:14:53 +08:00
guoguangwu 6dc23ca804 chore: remove refs to deprecated io/ioutil 2023-06-21 12:12:27 +08:00
Fan Shang Xiang b5e4ef628b bump k8s.io to 1.17.2 2023-06-12 22:27:39 +08:00
Kubernetes Prow RobotandGitHub 7b6805491c Merge pull request #716 from zendesk/grosser/silence
remove "Start watching journald" to avoid plugin log spam
2023-01-31 23:13:06 -08:00
Michael Grosser a83ef25930 remove "Start watching journald" to avoid plugin log spam 2023-01-31 21:31:31 -08:00
Yordis Prieto Lazo 0842910049 chore: fix misspelling 2022-12-18 22:58:07 -05:00
whwreflux 3fba7a9e86 fix README under systemlogmonitor 2022-07-29 17:14:46 +08:00
a39a7c6e0f Add condition message to event message
If you're using some monitoring solution that aggregates events from
your Kubernetes cluster, having the underlying reason why a condition
triggered could be very useful, especially if you are using custom
plugin monitors.

Co-authored-by: Micah Norman <micnorman@paypal.com>
Signed-off-by: Ryan Eschinger <reschinger@paypal.com>
2022-06-08 21:42:40 +00:00
Jeremy Edwards adc587f222 Support filelog watching in Windows. 2021-01-13 17:16:46 +00:00
Jeremy Edwards 4adec4bbc6 Introduce Windows build of Node Problem Detector 2020-12-05 23:54:52 +00:00
yuzhiquan b458f0d028 fix: modify typo 2019-12-03 15:21:57 +08:00
Lantao Liu be7cc78aa0 Properly close channel when monitor exits.
Signed-off-by: Lantao Liu <lantaol@google.com>
2019-10-25 14:11:39 -07:00
wenjun93 4a4ebc7097 avoid log channel closed caused endless loop 2019-10-25 11:43:49 +08:00
Andrew Stribblehill 09c498ad74 Empty LogPath will use journald's default path. 2019-08-27 01:55:30 +02:00
Zhen Wang 182a9450dd Print monitor config path in the logs 2019-07-30 11:00:47 -07:00
Xuewei Zhang 94af7de97b Report metrics from custom-plugin-monitor 2019-07-25 11:28:38 -07:00
Xuewei Zhang fbebcf311b Report metrics from system-log-monitor 2019-07-12 14:38:21 -07:00
Xuewei Zhang a07176073a Add existing monitors into the problem daemon registration hook. 2019-06-13 00:51:17 -07:00
Xuewei Zhang c6c4e80c9d Remove TestGoroutineLeak unit tests.
We are seeing some flakes on these tests because some goroutine
fluctuation:
https://github.com/kubernetes/node-problem-detector/pull/275#issuecomment-499306727

Removing the tests, as it's robust to test leakage in a soak/stress
test, rather than unit test.
2019-06-06 16:27:59 -07:00
Zhen Wang 1f636381b8 Detect kubelet and container runtime frequent crashes 2018-11-26 22:41:06 -08:00
AdamDangandGitHub 392ebe9c1b Typo fix in systemlogmonitor/README.md
configurtion->configuration
2018-09-25 10:13:48 +08:00
k8s-ci-robotandGitHub aabd369760 Merge pull request #151 from Random-Liu/improve-cpm
Improve cpm
2018-06-22 01:10:05 -07:00
AdamDangandGitHub e6e42175fa Typo fix: encounts->encounters
encounts->encounters
2018-06-22 14:04:45 +08:00
Lantao Liu ee103dd4ac Generate event for condition change and support unknown status. 2018-06-21 15:29:53 -07:00