Skip to content

Commit fc2e857

Browse files
committed
Add debug logs to app logs discovery
1 parent 9e842e9 commit fc2e857

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

internal/agent/ondemand/ondemand.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,7 @@ Ignored errors: %v
432432

433433
paths := config.AppLogs{}
434434
for _, f := range discoveredLogFiles {
435+
logger.Debug().Msgf("OnDemand FullCapture: discovered log file: %s", string(f))
435436
isGCLog := false
436437
for _, fileName := range globFiles {
437438
// To exclude discovered gc log such f as /tmp/buggyapp-%p-%t.log

internal/capture/app_logs_auto_discovery.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"regexp"
88
"runtime"
99
"unicode"
10+
"yc-agent/internal/logger"
1011
)
1112

1213
// logPatterns contains precompiled regex patterns so they are compiled once at startup rather than each function call.
@@ -34,6 +35,8 @@ func DiscoverOpenedLogFilesByProcess(pid int) ([]string, error) {
3435
}
3536

3637
for _, filePath := range openedFiles {
38+
logger.Debug().Msgf("DiscoverOpenedLogFilesByProcess: opened file by process (pid=%d): %s", pid, string(filePath))
39+
3740
fileBaseName := filepath.Base(filePath)
3841
if matchLogPattern(fileBaseName) {
3942
last1000Text, err := getLastNBytes(filePath, 1000)

internal/capture/applog.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ func (al *AppLog) Run() (Result, error) {
3636
pathStrings := make([]string, len(al.Paths))
3737
for i, path := range al.Paths {
3838
pathStrings[i] = string(path)
39+
40+
logger.Debug().Msgf("AppLog: glob path: %s", string(path))
3941
}
4042

4143
// Expand all paths (files, directories, globs) to individual files
@@ -50,6 +52,8 @@ func (al *AppLog) Run() (Result, error) {
5052

5153
// Process each expanded file path
5254
for _, filePath := range expandedPaths {
55+
logger.Debug().Msgf("AppLog: expanded path: %s", string(filePath))
56+
5357
r, err := al.CaptureSingleAppLog(filePath)
5458
results = append(results, r)
5559
errs = append(errs, err)

0 commit comments

Comments
 (0)