-
Notifications
You must be signed in to change notification settings - Fork 587
[FR] [DAC] Add Arbitrary File location Support for Local Creation Date #4915
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
Open
eric-forte-elastic
wants to merge
8
commits into
main
Choose a base branch
from
4891-fr-dac-add-arbitrary-file-location-support-for-local-creation-date
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[FR] [DAC] Add Arbitrary File location Support for Local Creation Date #4915
eric-forte-elastic
wants to merge
8
commits into
main
from
4891-fr-dac-add-arbitrary-file-location-support-for-local-creation-date
+64
−11
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Enhancement - GuidelinesThese guidelines serve as a reminder set of considerations when addressing adding a feature to the code. Documentation and Context
Code Standards and Practices
Testing
Additional Checks
|
…ort-for-local-creation-date
traut
reviewed
Jul 18, 2025
traut
reviewed
Jul 18, 2025
traut
reviewed
Jul 18, 2025
traut
reviewed
Jul 18, 2025
|
||
rule_contents = RuleCollection().load_file(rule_path).contents | ||
if not rule_path and not local_contents: | ||
raise ValueError("Either 'rule_path' or 'local_contents' must be provided.") |
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.
🙇🏻♂️
traut
reviewed
Jul 18, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
backport: auto
community
detections-as-code
enhancement
New feature or request
patch
python
Internal python for the repository
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request
Issue link(s):
Resolves #4891
Summary - What I changed
Added the ability to specify
--load-rule-loading / -lr
to thekibana export-rules
andimport-rules-to-repo
commands. This enables one to make use of the local folders specified in one'sconfig.yaml
when exporting rules from Kibana to the repo.For instance, if I specify
And have two rules
dac_test/rules/my_test_rule.toml
dac_test/another_rules_dir/high_number_of_process_and_or_service_terminations.toml
Rule updates from Kibana (when using the new
-lr
option) will now use these additional paths instead of exporting directly to the specified directory.So if I run
python -m detection_rules kibana --space test_local export-rules -d dac_test/rules/ -sv -ac -e -lr
in a space with those two rules,my_test_rule.toml
will be written todac_test/rules/
as it was already on disk there andhigh_number_of_process_and_or_service_terminations.toml
will be written todac_test/another_rules_dir/
for the same reason.Note: This can be very slow with a high number of rules. For instance, it can take 5-10min to load 1-2k rules in this way depending on system resources. The reason for this is the need to load the rule in from disk prior to actually exporting the rules, in order to know the appropriate path for the rule to be written.
How To Test
Run the respective
kibana export-rules
andimport-rules-to-repo
commands with some rules already existing in different directories specified in the custom rules config yaml.e.g.
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