-
Notifications
You must be signed in to change notification settings - Fork 529
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
[FR] Add Env Var DR_CLI_MAX_WIDTH and DaC Docs Updates #4518
base: main
Are you sure you want to change the base?
[FR] Add Env Var DR_CLI_MAX_WIDTH and DaC Docs Updates #4518
Conversation
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
|
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.
Locally tested the command with the variable. Works as expected
… github.com:elastic/detection-rules into 4517-bug-dac-detection_rules-help-texts-are-cut-off
@@ -133,6 +133,10 @@ For more advanced command line interface (CLI) usage, refer to the [CLI guide](C | |||
|
|||
We welcome your contributions to Detection Rules! Before contributing, please familiarize yourself with this repository, its [directory structure](#overview-of-this-repository), and our [philosophy](PHILOSOPHY.md) about rule creation. When you're ready to contribute, read the [contribution guide](CONTRIBUTING.md) to learn how we turn detection ideas into production rules and validate with testing. | |||
|
|||
## Detections as Code (DaC) |
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.
Can you add it to the table like in @traut Cortado PR
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.
Good call! Updated
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.
Could we change "custom rules.md" to something more related to dac rule management?
## Detections as Code (DaC) | ||
|
||
The Detection Rules repo includes a number of commands to help one manage rules with an "as code" philosophy. We recommend starting with our [DaC Specific Documentation](https://dac-reference.readthedocs.io/en/latest/) for strategies and recommended setup information. However, if you would prefer to jump right in, please see our [custom rules documentation](docs/custom-rules.md) for information on how to configure this repo for use with custom rules followed by our [CLI documentation](CLI.md) for information on our commands to import and export rules. | ||
|
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.
Did you want to change the custom-rules page name to more related to dac?
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.
Would renaming it to dac-custom-rules.md
alleviate your concern? My fear is that there may be customers looking for just setting up custom rules rather than a full dac pipeline, and those users may not know where to go for information.
Or perhaps something like detections-as-code-custom-rules
?
Alternatively, I we could change the name to dac.md
or detections-as-code.md
and we retain a header in that file called Custom Rules
so folks would have something find for this.
Thanks!
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.
Thanks @eric-forte-elastic for the detailed discussion yesterday, let's call this page custom-rules-management.md, and mention dac on the page itself.
@@ -281,7 +284,7 @@ Options: | |||
-id, --rule-id TEXT | |||
-r, --replace-id Replace rule IDs with new IDs before export | |||
-h, --help Show this message and exit. | |||
(detection-rules-build) (base) ➜ detection-rules git:(rule-loader) ✗ | |||
(detection-rules-build) (base) ➜ detection-rules git:(main) ✗ | |||
``` | |||
|
|||
Alternatively, rules can be exported into a consolidated ndjson file which can be imported in the Kibana security app |
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.
Please add sub-header to highlight this command.
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.
Would it make sense to move the upload-rule command below and make it more clear not to use it? Is it removed in 9.0?
@@ -281,7 +284,7 @@ Options: | |||
-id, --rule-id TEXT | |||
-r, --replace-id Replace rule IDs with new IDs before export | |||
-h, --help Show this message and exit. | |||
(detection-rules-build) (base) ➜ detection-rules git:(rule-loader) ✗ | |||
(detection-rules-build) (base) ➜ detection-rules git:(main) ✗ | |||
``` | |||
|
|||
Alternatively, rules can be exported into a consolidated ndjson file which can be imported in the Kibana security app |
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.
Would it make sense to move the upload-rule command below and make it more clear not to use it? Is it removed in 9.0?
Pull Request
Issue link(s):
Resolves #4517
Summary - What I changed
The current help text gets cut off in the Click CLI as a byproduct of Click's default settings. I have added an env variable
DR_CLI_MAX_WIDTH
that can be used to change the default value to a larger number to prevent the text from being cutoff. Additionally I have increased the value from the default value in order to prevent the text from being cutoffHow To Test
Run the following commands and see that the text is no longer cutoff
Expected Output:
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