Skip to content

Conversation

imays11
Copy link
Contributor

@imays11 imays11 commented Sep 2, 2025

Pull Request

Issue link(s):

Summary - What I changed

Tuning was triggered by a community member

  • fixes wildcard and Pulumi typos to exclude common IaC tools
  • adds exclusion for source.as.organization.name == "AMAZON-02" and aws.cloudtrail.event_category == "Data" to exclude the noisy multi-IP traffic coming from Amazon-02 networks performing high-throughput data-plane operations. I didn't exclude this network completely because this network can also indicate user-triggered events that are important to keep in the alert.
  • added additional high noise service providers that may be more indicative of console browsing
  • added a field for pairing source.ip & network values
  • added highlighted fields

How To Test

There's a saved timeline in our test stack which captures this query results over the last year, it includes the ByBit threat behavior this rule was initally meant to capture.

Screenshot 2025-09-03 at 12 24 34 PM

Tuning was triggered by a community member

- fixes wildcard and `Pulumi` typos to exclude common IaC tools
- adds exclusion for ``source.as.organization.name` == "AMAZON-02" and aws.cloudtrail.event_category == "Data"` to exclude the noisy multi-IP traffic coming from Amazon-02 networks performing high-throughput data-plane operations. I didn't exclude this network completely because this network can also indicate user-triggered events that are worth keeping in the alert.
- added additional high noise service providers that may be more indicative of console browsing
- added a field for pairing source.ip & network
- added highlighted fields
@imays11 imays11 added Integration: AWS AWS related rules Rule: Tuning tweaking or tuning an existing rule Team: TRADE Domain: Cloud labels Sep 3, 2025
@imays11 imays11 self-assigned this Sep 3, 2025
Copy link
Contributor

github-actions bot commented Sep 3, 2025

Rule: Tuning - Guidelines

These guidelines serve as a reminder set of considerations when tuning an existing rule.

Documentation and Context

  • Detailed description of the suggested changes.
  • Provide example JSON data or screenshots.
  • Provide evidence of reducing benign events mistakenly identified as threats (False Positives).
  • Provide evidence of enhancing detection of true threats that were previously missed (False Negatives).
  • Provide evidence of optimizing resource consumption and execution time of detection rules (Performance).
  • Provide evidence of specific environment factors influencing customized rule tuning (Contextual Tuning).
  • Provide evidence of improvements made by modifying sensitivity by changing alert triggering thresholds (Threshold Adjustments).
  • Provide evidence of refining rules to better detect deviations from typical behavior (Behavioral Tuning).
  • Provide evidence of improvements of adjusting rules based on time-based patterns (Temporal Tuning).
  • Provide reasoning of adjusting priority or severity levels of alerts (Severity Tuning).
  • Provide evidence of improving quality integrity of our data used by detection rules (Data Quality).
  • Ensure the tuning includes necessary updates to the release documentation and versioning.

Rule Metadata Checks

  • updated_date matches the date of tuning PR merged.
  • min_stack_version should support the widest stack versions.
  • name and description should be descriptive and not include typos.
  • query should be inclusive, not overly exclusive. Review to ensure the original intent of the rule is maintained.

Testing and Validation

  • Validate that the tuned rule's performance is satisfactory and does not negatively impact the stack.
  • Ensure that the tuned rule has a low false positive rate.

)
and `source.as.organization.name` != "AMAZON-AES"
and not ((
`source.as.organization.name` == "AMAZON-02" and aws.cloudtrail.event_category == "Data"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just making sure: are these backticks supported in ES|QL pipeline?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes and they used to be necessary for any field with as in the name since that means something in ESQL. We used to get errors when including this field without the backticks but I actually just tried it again without the backticks and am not getting those errors anymore so something might have changed with the language ability to recognize fields like this. I'm going to keep the backticks though as they are still supported.

| where Esql.activity_type != "normal_activity"
'''

[rule.investigation_fields]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if we have used dynamic fields in timelines before and what the implications are. With the best practices and guidelines being followed, key:value pairs like Esql.source_ip_values may show up in timelines whereas Esql.activity_fidelity_score is likely unique to this rule. That would only be for alerts too, not raw telemetry and may not be valuable to pivoting and triaging.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, they seem to be supported in the UI when modifying the rule, but I agree we should double check before merging.

Screenshot 2025-09-04 at 12 04 55 PM

Copy link
Contributor

@terrancedejesus terrancedejesus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should consider https://github.com/elastic/detection-rules/pull/5055/files#r2322658965 and make a decision before merging. I'd caution on not including them for ESQL rules with dynamic fields. Happy to consider other thoughts.

@imays11
Copy link
Contributor Author

imays11 commented Sep 11, 2025

We should consider https://github.com/elastic/detection-rules/pull/5055/files#r2322658965 and make a decision before merging. I'd caution on not including them for ESQL rules with dynamic fields. Happy to consider other thoughts.

Based on the docs we shouldn't have a problem here https://www.elastic.co/docs/solutions/security/detect-and-alert/create-detection-rule#custom-highlighted-esql-fields

When configuring an ES|QL rule’s Custom highlighted fields, you can specify any fields that the rule’s aggregating or non-aggregating query return. This can help ensure that returned fields are visible in the alert details flyout while you’re investigating alerts.

@imays11 imays11 merged commit 90ee151 into main Sep 11, 2025
11 checks passed
@imays11 imays11 deleted the tuning_aws_multiple_keys_esql branch September 11, 2025 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants