Skip to content
New issue

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

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

Already on GitHub? # to your account

[8.11](backport #37330) Remove event fields from error log. #37348

Merged
merged 1 commit into from
Dec 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion libbeat/processors/script/javascript/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
// Measure load times
start := time.Now()
defer func() {
took := time.Now().Sub(start)

Check failure on line 94 in libbeat/processors/script/javascript/session.go

View workflow job for this annotation

GitHub Actions / lint (windows)

S1012: should use `time.Since` instead of `time.Now().Sub` (gosimple)

Check failure on line 94 in libbeat/processors/script/javascript/session.go

View workflow job for this annotation

GitHub Actions / lint (linux)

S1012: should use `time.Since` instead of `time.Now().Sub` (gosimple)
logger.Debugf("Load of javascript pipeline took %v", took)
}()
// Setup JS runtime.
Expand Down Expand Up @@ -210,7 +210,6 @@
if r := recover(); r != nil {
s.log.Errorw("The javascript processor caused an unexpected panic "+
"while processing an event. Recovering, but please report this.",
"event", mapstr.M{"original": b.Fields.String()},
"panic", r,
zap.Stack("stack"))
if !s.evt.IsCancelled() {
Expand All @@ -218,9 +217,9 @@
}
err = fmt.Errorf("unexpected panic in javascript processor: %v", r)
if s.tagOnException != "" {
mapstr.AddTags(b.Fields, []string{s.tagOnException})

Check failure on line 220 in libbeat/processors/script/javascript/session.go

View workflow job for this annotation

GitHub Actions / lint (windows)

Error return value of `mapstr.AddTags` is not checked (errcheck)

Check failure on line 220 in libbeat/processors/script/javascript/session.go

View workflow job for this annotation

GitHub Actions / lint (linux)

Error return value of `mapstr.AddTags` is not checked (errcheck)
}
appendString(b.Fields, "error.message", err.Error(), false)

Check failure on line 222 in libbeat/processors/script/javascript/session.go

View workflow job for this annotation

GitHub Actions / lint (windows)

Error return value is not checked (errcheck)

Check failure on line 222 in libbeat/processors/script/javascript/session.go

View workflow job for this annotation

GitHub Actions / lint (linux)

Error return value is not checked (errcheck)
}
}()

Expand All @@ -239,9 +238,9 @@

if _, err = s.processFunc(goja.Undefined(), s.evt.JSObject()); err != nil {
if s.tagOnException != "" {
mapstr.AddTags(b.Fields, []string{s.tagOnException})

Check failure on line 241 in libbeat/processors/script/javascript/session.go

View workflow job for this annotation

GitHub Actions / lint (windows)

Error return value of `mapstr.AddTags` is not checked (errcheck)

Check failure on line 241 in libbeat/processors/script/javascript/session.go

View workflow job for this annotation

GitHub Actions / lint (linux)

Error return value of `mapstr.AddTags` is not checked (errcheck)
}
appendString(b.Fields, "error.message", err.Error(), false)

Check failure on line 243 in libbeat/processors/script/javascript/session.go

View workflow job for this annotation

GitHub Actions / lint (windows)

Error return value is not checked (errcheck)

Check failure on line 243 in libbeat/processors/script/javascript/session.go

View workflow job for this annotation

GitHub Actions / lint (linux)

Error return value is not checked (errcheck)
return b, fmt.Errorf("failed in process function: %w", err)
}

Expand Down
Loading