Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v17] Prevent logging exception due to nil attribute #49146

Open
wants to merge 1 commit into
base: branch/v17
Choose a base branch
from

Commits on Nov 18, 2024

  1. Prevent logging exception due to nil attribute

    The where condition being logged in SearchSession events is nil
    even though it's not nil, thanks Go, causing additional log spam.
    This addresses the issue by only passing in the condition if it
    was populated in the request.
    
    ```bash
    2024-11-18T13:04:02-05:00 DEBU [AUDIT]     SearchSessionEvents from:2024-11-18 05:00:00 +0000 UTC to:2024-11-19 04:59:59.999 +0000 UTC order:1 limit:5000 error:[LogValue panicked
    called from runtime.panicwrap (runtime/error.go:355)
    called from github.com/gravitational/teleport/api/types.(*WhereExpr).String (<autogenerated>:1)
    called from github.com/gravitational/teleport/lib/utils/log.stringerAttr.LogValue (github.com/gravitational/teleport/lib/utils/log/slog_handler.go:662)
    called from log/slog.Value.Resolve (log/slog/value.go:512)
    called from github.com/gravitational/teleport/lib/utils/log.(*SlogTextHandler).appendAttr (github.com/gravitational/teleport/lib/utils/log/slog_handler.go:140)
    (rest of stack elided)
    ] trace_id:42463c70955f653d0f992286feae738e span_id:a4e9b13d53f8f7d8 events/filelog.go:348
    ```
    rosstimothy authored and github-actions committed Nov 18, 2024
    Configuration menu
    Copy the full SHA
    b3b86d5 View commit details
    Browse the repository at this point in the history