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

[event log] add rule to event log shared object for provider: actions action: execute log event #99225

Closed
pmuellr opened this issue May 4, 2021 · 1 comment · Fixed by #101526
Assignees
Labels
Feature:EventLog Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams)

Comments

@pmuellr
Copy link
Member

pmuellr commented May 4, 2021

Currently, we do not add the rule saved object in the saved object references when we write the provider: actions, action: execute log entry. We do for provider: alerting, action: execute-action, which is logged when actions are queued to be run.

Historically, we weren't passing the rule into the action executor, so we didn't have the rule info to write out. That changed with RBAC, and we now have the rule when executing the action, so we should be able to provide that reference now.

This is fairly important to be able to track an action execution error to not just the connector that failed, but the alert it was run for.

Note: I could swear there was already an issue open for this, but not seeing it. We can close one as a DUP if someone else finds it.

The code where this would go, is here:

const event: IEvent = {
event: { action: EVENT_LOG_ACTIONS.execute },
kibana: {
saved_objects: [
{
rel: SAVED_OBJECT_REL_PRIMARY,
type: 'action',
id: actionId,
...namespace,
},
],
},
};

We'll have to figure out if we want the rel: SAVED_OBJECT_REL_PRIMARY on this - I think we do. This field indicates whether the event log doc will be returned when searching on just the alert SO. For the execute-action log, I believe we only use REL_PRIMARY for the rule, and not connector, because we don't want to expose what alerts are being run if you happen to just have a connector id to search for. Here's where that is done:

const event: IEvent = {
event: { action: EVENT_LOG_ACTIONS.executeAction },
kibana: {
alerting: {
instance_id: alertInstanceId,
action_group_id: actionGroup,
action_subgroup: actionSubgroup,
},
saved_objects: [
{ rel: SAVED_OBJECT_REL_PRIMARY, type: 'alert', id: alertId, ...namespace },
{ type: 'action', id: action.id, ...namespace },
],
},
};

@pmuellr pmuellr added Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) Feature:EventLog labels May 4, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-alerting-services (Team:Alerting Services)

@mikecote mikecote added this to Backlog in Kibana Alerting May 12, 2021
@mikecote mikecote moved this from Backlog to To-Do (Ordered by priority) in Kibana Alerting May 17, 2021
@pmuellr pmuellr self-assigned this Jun 7, 2021
@pmuellr pmuellr moved this from To-Do (Ordered by priority) to In Progress in Kibana Alerting Jun 7, 2021
pmuellr added a commit to pmuellr/kibana that referenced this issue Jun 7, 2021
pmuellr added a commit to pmuellr/kibana that referenced this issue Jun 14, 2021
pmuellr added a commit to pmuellr/kibana that referenced this issue Jun 17, 2021
pmuellr added a commit to pmuellr/kibana that referenced this issue Jun 18, 2021
pmuellr added a commit to pmuellr/kibana that referenced this issue Jun 20, 2021
@pmuellr pmuellr moved this from In Progress to In Review in Kibana Alerting Jun 20, 2021
Kibana Alerting automation moved this from In Review to Done (Ordered by most recent) Jun 22, 2021
pmuellr added a commit that referenced this issue Jun 22, 2021
…og doc (#101526)

resolves #99225

Prior to this PR, when an alerting connection action was executed, the event 
log document generated did not contain a reference to the originating rule. 
This makes it difficult to diagnose problems with connector errors, since 
the error is often in the parameters specified in the actions in the alert.

In this PR, a reference to the alerting rule is added to the saved_objects 
field in the event document for these events.
pmuellr added a commit to pmuellr/kibana that referenced this issue Jun 22, 2021
…og doc (elastic#101526)

resolves elastic#99225

Prior to this PR, when an alerting connection action was executed, the event 
log document generated did not contain a reference to the originating rule. 
This makes it difficult to diagnose problems with connector errors, since 
the error is often in the parameters specified in the actions in the alert.

In this PR, a reference to the alerting rule is added to the saved_objects 
field in the event document for these events.
pmuellr added a commit that referenced this issue Jun 22, 2021
…og doc (#101526) (#102994)

resolves #99225

Prior to this PR, when an alerting connection action was executed, the event 
log document generated did not contain a reference to the originating rule. 
This makes it difficult to diagnose problems with connector errors, since 
the error is often in the parameters specified in the actions in the alert.

In this PR, a reference to the alerting rule is added to the saved_objects 
field in the event document for these events.
@kobelb kobelb added the needs-team Issues missing a team label label Jan 31, 2022
@botelastic botelastic bot removed the needs-team Issues missing a team label label Jan 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:EventLog Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams)
Projects
No open projects
Kibana Alerting
Done (Ordered by most recent)
Development

Successfully merging a pull request may close this issue.

3 participants