Skip to content

Commit 7b1378d

Browse files
committed
[alerts] add executionStatus to event log doc for action execute (#82401)
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.
1 parent d283252 commit 7b1378d

File tree

13 files changed

+442
-132
lines changed

13 files changed

+442
-132
lines changed

x-pack/plugins/alerts/server/alert_instance/alert_instance.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ export class AlertInstance<
5151
return false;
5252
}
5353

54+
getLastScheduledActions() {
55+
return this.meta.lastScheduledActions;
56+
}
57+
5458
getScheduledActionOptions() {
5559
return this.scheduledExecutionOptions;
5660
}

x-pack/plugins/alerts/server/task_runner/create_execution_handler.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ test('enqueues execution per selected action', async () => {
113113
},
114114
"kibana": Object {
115115
"alerting": Object {
116+
"action_group_id": "default",
116117
"instance_id": "2",
117118
},
118119
"saved_objects": Array [

x-pack/plugins/alerts/server/task_runner/create_execution_handler.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ export function createExecutionHandler({
116116
kibana: {
117117
alerting: {
118118
instance_id: alertInstanceId,
119+
action_group_id: actionGroup,
119120
},
120121
saved_objects: [
121122
{ rel: SAVED_OBJECT_REL_PRIMARY, type: 'alert', id: alertId, ...namespace },

0 commit comments

Comments
 (0)