Skip to content

Commit

Permalink
Use --revert-pattern to discount proactive restarts
Browse files Browse the repository at this point in the history
  • Loading branch information
linxiulei committed Jan 17, 2024
1 parent 1002df5 commit c225435
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions config/systemd-monitor-counter.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
"--lookback=20m",
"--delay=5m",
"--count=5",
"--pattern=Started (Kubernetes kubelet|kubelet.service|kubelet.service - Kubernetes kubelet)."
"--pattern=Started (Kubernetes kubelet|kubelet.service|kubelet.service - Kubernetes kubelet).",
"--revert-pattern=Stopping (Kubernetes kubelet|kubelet.service|kubelet.service - Kubernetes kubelet)..."
],
"timeout": "1m"
},
Expand All @@ -51,7 +52,8 @@
"--log-path=/var/log/journal",
"--lookback=20m",
"--count=5",
"--pattern=Starting (Docker Application Container Engine|docker.service|docker.service - Docker Application Container Engine)..."
"--pattern=Starting (Docker Application Container Engine|docker.service|docker.service - Docker Application Container Engine)...",
"--revert-pattern=Stopping (Docker Application Container Engine|docker.service|docker.service - Docker Application Container Engine)..."
],
"timeout": "1m"
},
Expand All @@ -65,7 +67,8 @@
"--log-path=/var/log/journal",
"--lookback=20m",
"--count=5",
"--pattern=Starting (containerd container runtime|containerd.service|containerd.service - containerd container runtime)..."
"--pattern=Starting (containerd container runtime|containerd.service|containerd.service - containerd container runtime)...",
"--revert-pattern=Stopping (containerd container runtime|containerd.service|containerd.service - containerd container runtime)..."
],
"timeout": "1m"
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/logcounter/log_counter.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (e *logCounter) Count() (count int, err error) {
if len(e.buffer.Match(e.pattern)) != 0 {
count++
}
if len(e.buffer.Match(e.revertPattern)) != 0 {
if e.revertPattern != "" && len(e.buffer.Match(e.revertPattern)) != 0 {
count--
}
case <-e.clock.After(timeout):
Expand Down

0 comments on commit c225435

Please sign in to comment.