-
Notifications
You must be signed in to change notification settings - Fork 442
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
mimecast: Handle empty events in a time window inside threat events. #12937
Conversation
🚀 Benchmarks reportPackage
|
Data stream | Previous EPS | New EPS | Diff (%) | Result |
---|---|---|---|---|
audit_events |
3012.05 | 2298.85 | -713.2 (-23.68%) | 💔 |
message_release_logs |
4854.37 | 2747.25 | -2107.12 (-43.41%) | 💔 |
ttp_ap_logs |
8196.72 | 4651.16 | -3545.56 (-43.26%) | 💔 |
To see the full report comment with /test benchmark fullreport
Pinging @elastic/security-service-integrations (Team:Security-Service Integrations) |
: | ||
// Mimecast can return failure states with a 200. This | ||
// is detected by a non-empty fail array at the root | ||
// of the response body. Don't attempt to parse this | ||
// out, just dump the whole body into the error message. | ||
{ | ||
"events": { | ||
"error": { | ||
"code": string(resp.StatusCode), | ||
"id": string(resp.Status), | ||
"message": "POST " + state.path + ": " + string(resp.Body), // We know this is not empty. | ||
// of the response body. | ||
|
||
// Mimecast threat events return fail message | ||
// containing `err_threat_intel_feed_no_result_found` | ||
// when no events within the query time window. | ||
// Handle this by saving empty events array and | ||
// not report error. | ||
(body.?fail[?0].errors[?0].code.orValue("") == "err_threat_intel_feed_no_result_found") ? | ||
{ | ||
"events": [], | ||
// Override cursor to remove cursor.token if present. | ||
"cursor": { | ||
"last": state.?cursor.last, | ||
}, | ||
}, | ||
"want_more": false, | ||
} | ||
"want_more": false, | ||
} | ||
: | ||
// Don't attempt to parse this out, just dump the whole | ||
// body into the error message. | ||
{ | ||
"events": { | ||
"error": { | ||
"code": string(resp.StatusCode), | ||
"id": string(resp.Status), | ||
"message": "POST " + state.path + ": " + string(resp.Body), // We know this is not empty. | ||
}, | ||
}, | ||
"want_more": false, | ||
} |
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.
Suggest instead
diff --git a/packages/mimecast/data_stream/threat_intel_malware_customer/agent/stream/cel.yml.hbs b/packages/mimecast/data_stream/threat_intel_malware_customer/agent/stream/cel.yml.hbs
index c0b6b57272..b65f136681 100644
--- a/packages/mimecast/data_stream/threat_intel_malware_customer/agent/stream/cel.yml.hbs
+++ b/packages/mimecast/data_stream/threat_intel_malware_customer/agent/stream/cel.yml.hbs
@@ -107,9 +107,23 @@ program: |
},
"want_more": resp.?Header["X-Mc-Threat-Feed-Next-Token"].hasValue(),
}
+ : (body.?fail[0].errors[0].code.orValue("") == "err_threat_intel_feed_no_result_found") ?
+ // Mimecast threat events return fail message
+ // containing 'err_threat_intel_feed_no_result_found'
+ // when no events within the query time window.
+ // Handle this by saving empty events array but
+ // do not report an error.
+ {
+ "events": [],
+ // Override cursor to remove cursor.token if present.
+ "cursor": {
+ "last": state.?cursor.last,
+ },
+ "want_more": false,
+ }
:
- // Mimecast can return failure states with a 200. This
- // is detected by a non-empty fail array at the root
+ // Mimecast can also return other failure states with a 200.
+ // This is detected by a non-empty fail array at the root
// of the response body. Don't attempt to parse this
// out, just dump the whole body into the 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.
Updated in 57c77b4
💚 Build Succeeded
History
cc @kcreddy |
|
Package mimecast - 2.6.2 containing this change is available at https://epr.elastic.co/package/mimecast/2.6.2/ |
Proposed commit message
Note
Can be merged after #12936 (2.6.1) do avoid version conflict
Checklist
changelog.yml
file.How to test this PR locally
System tests pass