-
Notifications
You must be signed in to change notification settings - Fork 587
[Rule Tuning] ESQL Query Field Dynamic Field Standardization #4912
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
base: main
Are you sure you want to change the base?
[Rule Tuning] ESQL Query Field Dynamic Field Standardization #4912
Conversation
…gle User Over a Session
…gle User Over a Session
…ithin a Single Blocked Request
⛔️ Test failed Results
|
⛔️ Test failed Results
|
| sort violations desc | ||
|
||
// Keep relevant ECS + model fields | ||
| keep |
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.
Any reason we're mixing case for ES|QL functions? FROM
vs keep
vs stats
vs COUNT
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.
Not only the processing functions or commands, but logical operators can be lowercase or uppercase. There is variation amongst ESQL rules based on personal preference of the rule author. Since there are no inherit downsides, best practice against or for - I'd suggest leaving these as-is.
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.
Im just not sure if it's best. It's really a nit, but seeing them mixed when we're already touching all the rules appears odd.
// Aggregate all violation types per user | ||
| stats | ||
Esql.ml_policy_blocked_violation_total_count = SUM(Esql.ml_policy_blocked_violation_count) | ||
by |
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.
nit: I think single line is easier to read, but im assuming its just really long now.
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 think we have an opportunity to standardize esql function case.
otherwise great work!
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!
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.
Other than my comments, it looks g2g for Linux.
process.args IN ("-d", "-base64", "-a") | ||
) OR | ||
( | ||
process.name RLIKE "^python.*" AND ( |
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.
Why was this modified to RLIKE
?
) | ||
) OR | ||
( | ||
process.name RLIKE "^perl.*" AND |
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.
++
process.command_line LIKE "*decode_base64*" | ||
) OR | ||
( | ||
process.name RLIKE "^ruby.*" AND |
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.
++
host.name.values = VALUES(host.name), | ||
agent.id.values = VALUES(agent.id) |
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.
These two don't need an Esql.
prefix?
host.name.values = VALUES(host.name), | ||
agent.id.values = VALUES(agent.id) |
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.
++
host.name.values = VALUES(host.name), | ||
agent.id.values = VALUES(agent.id) |
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.
++
host.name.values = VALUES(host.name), | ||
agent.id.values = VALUES(agent.id) |
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.
++
host.name.values = VALUES(host.name), | ||
agent.id.values = VALUES(agent.id) |
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.
++
Pull Request
Issue link(s):
Summary - What I changed
Adjusts all ESQL queries in detection rules to standard field names based on previously established guidelines. Please see related issue and other related issues for more details.
How To Test
Almost all queries have been tested in the TRADE serverless stack to confirm logic was not adjusted unintentionally. It is recommended that anyone reviewing - if a query was written by them to test it on their own dataset to ensure logic has not changed.
Checklist
bug
,enhancement
,schema
,maintenance
,Rule: New
,Rule: Deprecation
,Rule: Tuning
,Hunt: New
, orHunt: Tuning
so guidelines can be generatedmeta:rapid-merge
label if planning to merge within 24 hoursContributor checklist