Skip to content

Commit

Permalink
[alerts] add executionStatus to event log doc for action execute (#82401
Browse files Browse the repository at this point in the history
)

resolves #79785

Until now, the execution status was available in the the event
log document for the execute action.  In this PR we add it.

The event log is extended to add the following fields:

- `kibana.alerting.status` - from executionStatus.status
- `event.reason`           - from executionStatus.error.reason

The date from the executionStatus and start date in the event
log will be set to the same value.

Previously, errors encountered while trying to execute an
alert executor, eg decrypting the alert, would not end up
with an event doc generated.  Now they will.

In addition, there were a few places where events that could
have had the action group in them did not, and one where the
instance id was undefined - those were fixed up.
  • Loading branch information
pmuellr authored Nov 12, 2020
1 parent 35656b9 commit c3e5794
Show file tree
Hide file tree
Showing 13 changed files with 442 additions and 132 deletions.
4 changes: 4 additions & 0 deletions x-pack/plugins/alerts/server/alert_instance/alert_instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ export class AlertInstance<
return false;
}

getLastScheduledActions() {
return this.meta.lastScheduledActions;
}

getScheduledActionOptions() {
return this.scheduledExecutionOptions;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ test('enqueues execution per selected action', async () => {
},
"kibana": Object {
"alerting": Object {
"action_group_id": "default",
"instance_id": "2",
},
"saved_objects": Array [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ export function createExecutionHandler({
kibana: {
alerting: {
instance_id: alertInstanceId,
action_group_id: actionGroup,
},
saved_objects: [
{ rel: SAVED_OBJECT_REL_PRIMARY, type: 'alert', id: alertId, ...namespace },
Expand Down
Loading

0 comments on commit c3e5794

Please sign in to comment.