Skip to content

Commit 4561950

Browse files
author
Ricardo Lüders
committed
Improve stack trace detector regex
1 parent 8abde71 commit 4561950

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/gather/clusterconfig/operators_pods_and_events.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ type CompactedEventList struct {
3939
}
4040

4141
// Used to detect the possible stack trace on logs
42-
var stackTraceRegex = regexp.MustCompile(`((.*)(/{0,9}){0,9}).([0-9]{0,9})`)
42+
var stackTraceRegex = regexp.MustCompile(`.*/[^/]*:\d+.*0[xX][0-9a-fA-F]+`)
4343

4444
// GatherClusterOperatorPodsAndEvents collects information about all pods
4545
// and events from namespaces of degraded cluster operators. The collected
@@ -272,7 +272,7 @@ func getContainerLogs(ctx context.Context,
272272

273273
// check for stack tracer
274274
if found := stackTraceRegex.MatchString(logString); found {
275-
klog.V(2).Infof("Stack trace found in log. Fetching the complete log for %s container in namespace %s (previous: %v).", c.Name, pod.Name, pod.Namespace, isPrevious)
275+
klog.V(2).Infof("Stack trace found in log. Fetching the complete log for %s container %s pod in namespace %s (previous: %v).", c.Name, pod.Name, pod.Namespace, isPrevious)
276276
fullLog, err := getContainerLogString(ctx, client, pod, c.Name, isPrevious, nil)
277277
if err != nil {
278278
klog.V(2).Infof("Error: %q", err)

0 commit comments

Comments
 (0)