Skip to content
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

update rule query clarification #2985

Merged
merged 3 commits into from
Apr 3, 2023
Merged

update rule query clarification #2985

merged 3 commits into from
Apr 3, 2023

Conversation

Tibo669
Copy link
Contributor

@Tibo669 Tibo669 commented Feb 15, 2023

The example 2 provided in the documentation has a few typos and is using an incorrect parameter.

Also the documentation on the "params" in the action schema could use an example.
https://www.elastic.co/guide/en/security/current/bulk-actions-rules-api.html#actions-object-schema-bulk
image

It can be difficult to apprehend that you need to define it as a list with a single item that is an array. An example would have made it a lot more clear.
Like for example:

POST api/detection_engine/rules/_bulk_action
"query": "alert.attributes.params.severity: \"critical\"",
"action": "edit",
"edit": [
{
"type": "set_rule_actions",
"value": {
"actions": [
{
"id": "id",
"group": "default",
"params": {
"subAction": "pushToService",
"subActionParams": {
"incident": {
"issueType": "10009",
"priority": "Critical",
"description": "{{#context.alerts}}\n*Host:* {{host.name}} ({{source.ip}}) *OS:* {{host.os.name}} {{host.os.version}}\n*Time:* {{event.start}} - {{event.end}}\n*Reason:* {{signal.reason}}\n\n*------------------ Optional Fields ------------------*\n*Username:* {{winlog.user.name}} - {{user.name}}\n*File name:* {{file.name}}\n*Process Name:* {{process.name}} \n*Parent Process:* {{parent.process.name}}\n*-----------------------------------------------------*\n{{/context.alerts}}\n\n*Count of events:* {{state.signals_count}}\n\n*Link:* TENANTURL{{{context.results_link}}}",
"summary": "{{context.rule.name}} - {{context.rule.severity}}"
},
"comments": [
{
"commentId": "1",
"comment": "*Description:* {{context.rule.description}}\n\n*Rule Severity:* {{context.rule.severity}}\n\n*References:* {{context.rule.references}}\n\n*Possible false positive reason:* {{context.rule.false_positives}}\n\n*MITRE ATT&CK and ID:* {{context.rule.threat}}"
}
]
}
}
},
{
"group": "default",
"id": "id",
"params": {
"message": "# **{{context.rule.name}}**\n\n**Alerts:** {{state.signals_count}}\n\n**Severity:** {{context.rule.severity}}\n\n**Kibana URL:** TENANTURL{{{context.results_link}}}"
}
}
],
"throttle": "rule"
}
}
]

The example 2 provided in the documentation has a few typos and is using an incorrect parameter.
@github-actions
Copy link

Documentation previews:

@mergify
Copy link
Contributor

mergify bot commented Feb 15, 2023

This pull request does not have a backport label. Could you fix it @Tibo669? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • v7.x is the label to automatically backport to the 7.x branch.
  • v7./d./d is the label to automatically backport to the 7./d branch. /d is the digit

NOTE: backport-skip has been added to this pull request.

Copy link
Contributor

@banderror banderror left a comment

Choose a reason for hiding this comment

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

Appreciate the fix @Tibo669 🙏 I agree, the docs could have been better. I opened #3019 based on your feedback and we'll work with the docs team on improving it in the next release cycles.

@jmikell821
Copy link
Contributor

Hey @banderror is it safe to close this PR since changes were updated in #3019?

@banderror
Copy link
Contributor

Hey @jmikell821, not sure I understand the question. #3019 is a follow-up issue, it doesn't update the docs.

@jmikell821
Copy link
Contributor

Hey @jmikell821, not sure I understand the question. #3019 is a follow-up issue, it doesn't update the docs.

Oops, sorry @banderror, I misread. If the changes @Tibo669 made look good to you (they look 👍 to me), I can merge this. Thanks!

@banderror banderror merged commit f7aff54 into elastic:main Apr 3, 2023
mergify bot pushed a commit that referenced this pull request Apr 3, 2023
The example 2 provided in the documentation has a few typos and is using an incorrect parameter.

Also the documentation on the "params" in the action schema could use an example.
https://www.elastic.co/guide/en/security/current/bulk-actions-rules-api.html#actions-object-schema-bulk
![image](https://user-images.githubusercontent.com/22603166/218981222-839eca6c-117b-42a8-98fc-cd47f310919a.png)

It can be difficult to apprehend that you need to define it as a list with a single item that is an array. An example would have made it a lot more clear.
Like for example:
```
POST api/detection_engine/rules/_bulk_action
"query": "alert.attributes.params.severity: \"critical\"",
"action": "edit",
"edit": [
{
"type": "set_rule_actions",
"value": {
"actions": [
{
"id": "id",
"group": "default",
"params": {
"subAction": "pushToService",
"subActionParams": {
"incident": {
"issueType": "10009",
"priority": "Critical",
"description": "{{#context.alerts}}\n*Host:* {{host.name}} ({{source.ip}}) *OS:* {{host.os.name}} {{host.os.version}}\n*Time:* {{event.start}} - {{event.end}}\n*Reason:* {{signal.reason}}\n\n*------------------ Optional Fields ------------------*\n*Username:* {{winlog.user.name}} - {{user.name}}\n*File name:* {{file.name}}\n*Process Name:* {{process.name}} \n*Parent Process:* {{parent.process.name}}\n*-----------------------------------------------------*\n{{/context.alerts}}\n\n*Count of events:* {{state.signals_count}}\n\n*Link:* TENANTURL{{{context.results_link}}}",
"summary": "{{context.rule.name}} - {{context.rule.severity}}"
},
"comments": [
{
"commentId": "1",
"comment": "*Description:* {{context.rule.description}}\n\n*Rule Severity:* {{context.rule.severity}}\n\n*References:* {{context.rule.references}}\n\n*Possible false positive reason:* {{context.rule.false_positives}}\n\n*MITRE ATT&CK and ID:* {{context.rule.threat}}"
}
]
}
}
},
{
"group": "default",
"id": "id",
"params": {
"message": "# **{{context.rule.name}}**\n\n**Alerts:** {{state.signals_count}}\n\n**Severity:** {{context.rule.severity}}\n\n**Kibana URL:** TENANTURL{{{context.results_link}}}"
}
}
],
"throttle": "rule"
}
}
]
```

(cherry picked from commit f7aff54)
mergify bot pushed a commit that referenced this pull request Apr 3, 2023
The example 2 provided in the documentation has a few typos and is using an incorrect parameter.

Also the documentation on the "params" in the action schema could use an example.
https://www.elastic.co/guide/en/security/current/bulk-actions-rules-api.html#actions-object-schema-bulk
![image](https://user-images.githubusercontent.com/22603166/218981222-839eca6c-117b-42a8-98fc-cd47f310919a.png)

It can be difficult to apprehend that you need to define it as a list with a single item that is an array. An example would have made it a lot more clear.
Like for example:
```
POST api/detection_engine/rules/_bulk_action
"query": "alert.attributes.params.severity: \"critical\"",
"action": "edit",
"edit": [
{
"type": "set_rule_actions",
"value": {
"actions": [
{
"id": "id",
"group": "default",
"params": {
"subAction": "pushToService",
"subActionParams": {
"incident": {
"issueType": "10009",
"priority": "Critical",
"description": "{{#context.alerts}}\n*Host:* {{host.name}} ({{source.ip}}) *OS:* {{host.os.name}} {{host.os.version}}\n*Time:* {{event.start}} - {{event.end}}\n*Reason:* {{signal.reason}}\n\n*------------------ Optional Fields ------------------*\n*Username:* {{winlog.user.name}} - {{user.name}}\n*File name:* {{file.name}}\n*Process Name:* {{process.name}} \n*Parent Process:* {{parent.process.name}}\n*-----------------------------------------------------*\n{{/context.alerts}}\n\n*Count of events:* {{state.signals_count}}\n\n*Link:* TENANTURL{{{context.results_link}}}",
"summary": "{{context.rule.name}} - {{context.rule.severity}}"
},
"comments": [
{
"commentId": "1",
"comment": "*Description:* {{context.rule.description}}\n\n*Rule Severity:* {{context.rule.severity}}\n\n*References:* {{context.rule.references}}\n\n*Possible false positive reason:* {{context.rule.false_positives}}\n\n*MITRE ATT&CK and ID:* {{context.rule.threat}}"
}
]
}
}
},
{
"group": "default",
"id": "id",
"params": {
"message": "# **{{context.rule.name}}**\n\n**Alerts:** {{state.signals_count}}\n\n**Severity:** {{context.rule.severity}}\n\n**Kibana URL:** TENANTURL{{{context.results_link}}}"
}
}
],
"throttle": "rule"
}
}
]
```

(cherry picked from commit f7aff54)
jmikell821 pushed a commit that referenced this pull request Apr 3, 2023
The example 2 provided in the documentation has a few typos and is using an incorrect parameter.

Also the documentation on the "params" in the action schema could use an example.
https://www.elastic.co/guide/en/security/current/bulk-actions-rules-api.html#actions-object-schema-bulk
![image](https://user-images.githubusercontent.com/22603166/218981222-839eca6c-117b-42a8-98fc-cd47f310919a.png)

It can be difficult to apprehend that you need to define it as a list with a single item that is an array. An example would have made it a lot more clear.
Like for example:
```
POST api/detection_engine/rules/_bulk_action
"query": "alert.attributes.params.severity: \"critical\"",
"action": "edit",
"edit": [
{
"type": "set_rule_actions",
"value": {
"actions": [
{
"id": "id",
"group": "default",
"params": {
"subAction": "pushToService",
"subActionParams": {
"incident": {
"issueType": "10009",
"priority": "Critical",
"description": "{{#context.alerts}}\n*Host:* {{host.name}} ({{source.ip}}) *OS:* {{host.os.name}} {{host.os.version}}\n*Time:* {{event.start}} - {{event.end}}\n*Reason:* {{signal.reason}}\n\n*------------------ Optional Fields ------------------*\n*Username:* {{winlog.user.name}} - {{user.name}}\n*File name:* {{file.name}}\n*Process Name:* {{process.name}} \n*Parent Process:* {{parent.process.name}}\n*-----------------------------------------------------*\n{{/context.alerts}}\n\n*Count of events:* {{state.signals_count}}\n\n*Link:* TENANTURL{{{context.results_link}}}",
"summary": "{{context.rule.name}} - {{context.rule.severity}}"
},
"comments": [
{
"commentId": "1",
"comment": "*Description:* {{context.rule.description}}\n\n*Rule Severity:* {{context.rule.severity}}\n\n*References:* {{context.rule.references}}\n\n*Possible false positive reason:* {{context.rule.false_positives}}\n\n*MITRE ATT&CK and ID:* {{context.rule.threat}}"
}
]
}
}
},
{
"group": "default",
"id": "id",
"params": {
"message": "# **{{context.rule.name}}**\n\n**Alerts:** {{state.signals_count}}\n\n**Severity:** {{context.rule.severity}}\n\n**Kibana URL:** TENANTURL{{{context.results_link}}}"
}
}
],
"throttle": "rule"
}
}
]
```

(cherry picked from commit f7aff54)

Co-authored-by: Thibaut Besacier <[email protected]>
jmikell821 pushed a commit that referenced this pull request Apr 3, 2023
The example 2 provided in the documentation has a few typos and is using an incorrect parameter.

Also the documentation on the "params" in the action schema could use an example.
https://www.elastic.co/guide/en/security/current/bulk-actions-rules-api.html#actions-object-schema-bulk
![image](https://user-images.githubusercontent.com/22603166/218981222-839eca6c-117b-42a8-98fc-cd47f310919a.png)

It can be difficult to apprehend that you need to define it as a list with a single item that is an array. An example would have made it a lot more clear.
Like for example:
```
POST api/detection_engine/rules/_bulk_action
"query": "alert.attributes.params.severity: \"critical\"",
"action": "edit",
"edit": [
{
"type": "set_rule_actions",
"value": {
"actions": [
{
"id": "id",
"group": "default",
"params": {
"subAction": "pushToService",
"subActionParams": {
"incident": {
"issueType": "10009",
"priority": "Critical",
"description": "{{#context.alerts}}\n*Host:* {{host.name}} ({{source.ip}}) *OS:* {{host.os.name}} {{host.os.version}}\n*Time:* {{event.start}} - {{event.end}}\n*Reason:* {{signal.reason}}\n\n*------------------ Optional Fields ------------------*\n*Username:* {{winlog.user.name}} - {{user.name}}\n*File name:* {{file.name}}\n*Process Name:* {{process.name}} \n*Parent Process:* {{parent.process.name}}\n*-----------------------------------------------------*\n{{/context.alerts}}\n\n*Count of events:* {{state.signals_count}}\n\n*Link:* TENANTURL{{{context.results_link}}}",
"summary": "{{context.rule.name}} - {{context.rule.severity}}"
},
"comments": [
{
"commentId": "1",
"comment": "*Description:* {{context.rule.description}}\n\n*Rule Severity:* {{context.rule.severity}}\n\n*References:* {{context.rule.references}}\n\n*Possible false positive reason:* {{context.rule.false_positives}}\n\n*MITRE ATT&CK and ID:* {{context.rule.threat}}"
}
]
}
}
},
{
"group": "default",
"id": "id",
"params": {
"message": "# **{{context.rule.name}}**\n\n**Alerts:** {{state.signals_count}}\n\n**Severity:** {{context.rule.severity}}\n\n**Kibana URL:** TENANTURL{{{context.results_link}}}"
}
}
],
"throttle": "rule"
}
}
]
```

(cherry picked from commit f7aff54)

Co-authored-by: Thibaut Besacier <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants