[azure logs] Fix sign-in logs category check#17027
Conversation
We can't assume category will not be null.
🚀 Benchmarks reportTo see the full report comment with |
The `?` seems to work when checking field access, but not when checking field access 🤔
💚 Build Succeeded
History
cc @zmoog |
|
Pinging @elastic/security-service-integrations (Team:Security-Service Integrations) |
| value: azure.signinlogs | ||
| # Use same logic as the `signinlogs` stream that drops any document that doesn't end with `SignInLogs`. | ||
| if: 'ctx.routing?.category.endsWith("SignInLogs")' | ||
| if: 'ctx.routing?.category != null && ctx.routing?.category.endsWith("SignInLogs")' |
There was a problem hiding this comment.
| if: 'ctx.routing?.category != null && ctx.routing?.category.endsWith("SignInLogs")' | |
| if: 'ctx.routing?.category != null && ctx.routing.category.endsWith("SignInLogs")' |
There was a problem hiding this comment.
Does this pipeline guarantee the routing field? It looks like it might be optional here.
There was a problem hiding this comment.
if we remove the question mark then we would need to add ctx.routing != null in the beginning and remove all question marks.
I think we should keep it as it is in the PR now
| value: azure.signinlogs | ||
| # Use same logic as the `signinlogs` stream that drops any document that doesn't end with `SignInLogs`. | ||
| if: 'ctx.routing?.category.endsWith("SignInLogs")' | ||
| if: 'ctx.routing?.category != null && ctx.routing?.category.endsWith("SignInLogs")' |
There was a problem hiding this comment.
If we are not processing the logs with no category then should we drop the event which doesn't have category?
There was a problem hiding this comment.
Um, I think we keep the log events.
Two reasons:
- Azure has been inconsistent in naming the field that contains the log category. So far we know they mostly usage
category, but also foundCategoryandCategoryValuein the wild. So I guess an suboptimal indexing is better than losing the log event. - custom routing: we recently added
routing.categoryas candidate field for custom routing, but users may want to customize the routing based on other criteria and fields. If we drop the log event in the main pipeline, it will never reach the custom pipeline.
|
Package azure - 1.35.1 containing this change is available at https://epr.elastic.co/package/azure/1.35.1/ |
Add an explicit check on ctx.routing?.category to make sure it's not null before calling the endsWith("SignInLogs") method.
We can't assume category is always set.
Proposed commit message
Add an explicit check on
ctx.routing?.categoryto make sure it's not null before calling theendsWith("SignInLogs")method.We can't assume category is always set.
Checklist
changelog.ymlfile.I have verified that Kibana version constraints are current according to guidelines.I have verified that any added dashboard complies with Kibana's Dashboard good practicesHow to test this PR locally
Related issues