-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
x-pack/filebeat/input/cel: fix handling of non-200/non-429 status codes #34002
Conversation
Previously, non-200/non-429 status codes would cause an immediate retry, resulting in spamming the server. Treat these responses as an error and wait until the next event period.
return false, waitUntil, nil | ||
default: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should consider stratifying these.
Pinging @elastic/security-external-integrations (Team:Security-External Integrations) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I tested it. Just a minor issue with the "dot" in the field name.
x-pack/filebeat/input/cel/input.go
Outdated
if status == "" { | ||
status = "unknown status code" | ||
} | ||
state["events"] = map[string]interface{}{"error.message": fmt.Sprintf("failed http request with %s: %d", status, statusCode)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error.message
will result in a key containing a dot. Can you please change that to produce {"error":{"message":...
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That should happen in the other error.message
constructions too then.
Also make error.message structured to avoid dotted field names.
func errorMessage(msg string) map[string]interface{} { | ||
return map[string]interface{}{"error": map[string]interface{}{"message": msg}} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Query whether this should be
func errorMessage(msg ...string) map[string]interface{} {
return map[string]interface{}{"error": map[string]interface{}{"message": msg}}
}
Kudos, SonarCloud Quality Gate passed! |
…es (#34002) (#34006) Previously, non-200/non-429 status codes would cause an immediate retry, resulting in spamming the server. Treat these responses as an error and wait until the next event period. Also make error.message structured to avoid dotted field names. (cherry picked from commit 64691d3) Co-authored-by: Dan Kortschak <[email protected]>
…es (#34002) Previously, non-200/non-429 status codes would cause an immediate retry, resulting in spamming the server. Treat these responses as an error and wait until the next event period. Also make error.message structured to avoid dotted field names.
What does this PR do?
Previously, non-200/non-429 status codes would cause an immediate retry, resulting in spamming the server. Treat these responses as an error and wait until the next event period.
Why is it important?
Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Author's Checklist
How to test this PR locally
Related issues
Use cases
Screenshots
Logs