diff --git a/README.md b/README.md index 14be0747..62c644f4 100644 --- a/README.md +++ b/README.md @@ -97,11 +97,17 @@ spec: - name: log mountPath: /log readOnly: true + - name: localtime + mountPath: /etc/localtime + readOnly: true volumes: - name: log # Config `log` to your system log directory hostPath: path: /var/log/ + - name: localtime + hostPath: + path: /etc/localtime ``` * Edit node-problem-detector.yaml to fit your environment: Set `log` volume to your system log diretory. (Used by KernelMonitor) * Create the DaemonSet with `kubectl create -f node-problem-detector.yaml` diff --git a/config/kernel-monitor.json b/config/kernel-monitor.json index 6db7afc5..9b967440 100644 --- a/config/kernel-monitor.json +++ b/config/kernel-monitor.json @@ -1,6 +1,6 @@ { "plugin": "journald", - "logPath": "/log/journal", + "logPath": "/var/log/journal", "lookback": "10m", "startPattern": "Initializing cgroup subsys cpuset", "bufferSize": 10, diff --git a/node-problem-detector.yaml b/node-problem-detector.yaml index 385e693c..7b742f5b 100644 --- a/node-problem-detector.yaml +++ b/node-problem-detector.yaml @@ -25,7 +25,7 @@ spec: fieldPath: spec.nodeName volumeMounts: - name: log - mountPath: /log + mountPath: /var/log readOnly: true # Make sure node problem detector is in the same timezone # with the host. diff --git a/pkg/kernelmonitor/README.md b/pkg/kernelmonitor/README.md index 329a5d34..afb838b3 100644 --- a/pkg/kernelmonitor/README.md +++ b/pkg/kernelmonitor/README.md @@ -9,12 +9,8 @@ The rule list is extensible. ## Limitations -* Kernel Monitor only supports file based kernel log now. It doesn't support log tools -like journald. There is an [open issue](https://github.com/kubernetes/node-problem-detector/issues/14) -to add journald support. - -* Kernel Monitor has assumption on kernel log format, now it only works on Ubuntu and -Debian. However, it is easy to extend it to [support other log format](#support-other-log-format). +* Kernel Monitor only supports syslog (rsyslog) and journald now, but it is easy + to extend it with [new log watcher](#new-log-watcher) ## Add New NodeConditions @@ -43,14 +39,23 @@ with new rule definition: } ``` -## Change Log Path +## Log Watchers -Kernel log in different OS distros may locate in different path. The `log` +Kernel monitor supports different log management tools with different log +watchers: +* [syslog](https://github.com/kubernetes/node-problem-detector/blob/master/pkg/kernelmonitor/logwatchers/syslog) +* [journald](https://github.com/kubernetes/node-problem-detector/blob/master/pkg/kernelmonitor/logwatchers/journald) + +### Change Log Path + +Kernel log on different OS distros may locate in different path. The `logPath` field in `config/kernel-monitor.json` is the log path inside the container. -You can always configure it to match your OS distro. +You can always configure `logPath` and volume mount to match your OS distro. +* syslog: `logPath` is the kernel log path, usually `/var/log/kern.log`. +* journald: `logPath` is the journal log directory, usually `/var/log/journal`. -## Support Other Log Format +### New Log Watcher -Kernel monitor uses [`Translator`](https://github.com/kubernetes/node-problem-detector/blob/master/pkg/kernelmonitor/translator/translator.go) -plugin to translate kernel log the internal data structure. It is easy to -implement a new translator for a new log format. +Kernel monitor uses [Log +Watcher](https://github.com/kubernetes/node-problem-detector/blob/master/pkg/kernelmonitor/logwatchers/types/log_watcher.go) to support different log management tools. +It is easy to implement a new log watcher.