mirror of
https://github.com/kubernetes/node-problem-detector.git
synced 2026-08-23 22:26:27 +00:00
Add multiple log monitoring support.
This commit is contained in:
@@ -20,6 +20,7 @@ package journald
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -134,6 +135,11 @@ func getJournal(cfg types.WatcherConfig) (*sdjournal.Journal, error) {
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to parse lookback duration %q: %v", cfg.Lookback, err)
|
||||
}
|
||||
// If the path doesn't present, NewJournalFromDir will create it instead of
|
||||
// returning error. So check the path existence ourselves.
|
||||
if _, err := os.Stat(path); err != nil {
|
||||
return nil, fmt.Errorf("failed to stat the log path %q: %v", path, err)
|
||||
}
|
||||
// Get journal client from the log path.
|
||||
journal, err := sdjournal.NewJournalFromDir(path)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user