Skip to content

Commit cbbbe12

Browse files
Merge branch '7.x' into backport/7.x/pr-64540
2 parents f47174e + 5b6028a commit cbbbe12

File tree

91 files changed

+1861
-772
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+1861
-772
lines changed

x-pack/plugins/actions/server/lib/action_executor.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,18 @@ export class ActionExecutor {
140140
status: 'ok',
141141
};
142142

143+
event.event = event.event || {};
144+
143145
if (result.status === 'ok') {
146+
event.event.outcome = 'success';
144147
event.message = `action executed: ${actionLabel}`;
145148
} else if (result.status === 'error') {
149+
event.event.outcome = 'failure';
146150
event.message = `action execution failure: ${actionLabel}`;
147151
event.error = event.error || {};
148152
event.error.message = actionErrorToMessage(result);
149153
} else {
154+
event.event.outcome = 'failure';
150155
event.message = `action execution returned unexpected result: ${actionLabel}`;
151156
event.error = event.error || {};
152157
event.error.message = 'action execution returned unexpected result';

x-pack/plugins/alerting/server/task_runner/task_runner.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ describe('Task Runner', () => {
165165
Object {
166166
"event": Object {
167167
"action": "execute",
168+
"outcome": "success",
168169
},
169170
"kibana": Object {
170171
"saved_objects": Array [
@@ -226,6 +227,7 @@ describe('Task Runner', () => {
226227
Object {
227228
"event": Object {
228229
"action": "execute",
230+
"outcome": "success",
229231
},
230232
"kibana": Object {
231233
"saved_objects": Array [
@@ -342,6 +344,7 @@ describe('Task Runner', () => {
342344
Object {
343345
"event": Object {
344346
"action": "execute",
347+
"outcome": "success",
345348
},
346349
"kibana": Object {
347350
"saved_objects": Array [
@@ -558,6 +561,7 @@ describe('Task Runner', () => {
558561
},
559562
"event": Object {
560563
"action": "execute",
564+
"outcome": "failure",
561565
},
562566
"kibana": Object {
563567
"saved_objects": Array [

x-pack/plugins/alerting/server/task_runner/task_runner.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,16 @@ export class TaskRunner {
202202
event.message = `alert execution failure: ${alertLabel}`;
203203
event.error = event.error || {};
204204
event.error.message = err.message;
205+
event.event = event.event || {};
206+
event.event.outcome = 'failure';
205207
eventLogger.logEvent(event);
206208
throw err;
207209
}
208210

209211
eventLogger.stopTiming(event);
210212
event.message = `alert executed: ${alertLabel}`;
213+
event.event = event.event || {};
214+
event.event.outcome = 'success';
211215
eventLogger.logEvent(event);
212216

213217
// Cleanup alert instances that are no longer scheduling actions to avoid over populating the alertInstances object
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
export class AlertConstants {
8+
/**
9+
* The prefix for all Alert APIs
10+
*/
11+
static BASE_API_URL = '/api/endpoint';
12+
/**
13+
* The path for the Alert's Index Pattern API.
14+
*/
15+
static INDEX_PATTERN_ROUTE = `${AlertConstants.BASE_API_URL}/index_pattern`;
16+
/**
17+
* Alert's Index pattern
18+
*/
19+
static ALERT_INDEX_NAME = 'events-endpoint-1';
20+
/**
21+
* A paramter passed to Alert's Index Pattern.
22+
*/
23+
static EVENT_DATASET = 'events';
24+
/**
25+
* Alert's Search API default page size
26+
*/
27+
static DEFAULT_TOTAL_HITS = 10000;
28+
/**
29+
* Alerts
30+
**/
31+
static ALERT_LIST_DEFAULT_PAGE_SIZE = 10;
32+
static ALERT_LIST_DEFAULT_SORT = '@timestamp';
33+
static MAX_LONG_INT = '9223372036854775807'; // 2^63-1
34+
}

x-pack/plugins/endpoint/common/generate_data.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import seedrandom from 'seedrandom';
99
import {
1010
AlertEvent,
1111
EndpointEvent,
12-
HostFields,
12+
Host,
1313
HostMetadata,
14-
OSFields,
14+
HostOS,
1515
PolicyData,
1616
HostPolicyResponse,
1717
HostPolicyResponseActionStatus,
@@ -29,7 +29,7 @@ interface EventOptions {
2929
processName?: string;
3030
}
3131

32-
const Windows: OSFields[] = [
32+
const Windows: HostOS[] = [
3333
{
3434
name: 'windows 10.0',
3535
full: 'Windows 10',
@@ -56,11 +56,11 @@ const Windows: OSFields[] = [
5656
},
5757
];
5858

59-
const Linux: OSFields[] = [];
59+
const Linux: HostOS[] = [];
6060

61-
const Mac: OSFields[] = [];
61+
const Mac: HostOS[] = [];
6262

63-
const OS: OSFields[] = [...Windows, ...Mac, ...Linux];
63+
const OS: HostOS[] = [...Windows, ...Mac, ...Linux];
6464

6565
const POLICIES: Array<{ name: string; id: string }> = [
6666
{
@@ -102,7 +102,7 @@ interface HostInfo {
102102
version: string;
103103
id: string;
104104
};
105-
host: HostFields;
105+
host: Host;
106106
endpoint: {
107107
policy: {
108108
id: string;

x-pack/plugins/endpoint/common/schema/alert_index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import { schema, Type } from '@kbn/config-schema';
88
import { i18n } from '@kbn/i18n';
99
import { decode } from 'rison-node';
10-
import { EndpointAppConstants } from '../types';
10+
import { AlertConstants } from '../alert_constants';
1111

1212
/**
1313
* Used to validate GET requests against the index of the alerting APIs.
@@ -18,7 +18,7 @@ export const alertingIndexGetQuerySchema = schema.object(
1818
schema.number({
1919
min: 1,
2020
max: 100,
21-
defaultValue: EndpointAppConstants.ALERT_LIST_DEFAULT_PAGE_SIZE,
21+
defaultValue: AlertConstants.ALERT_LIST_DEFAULT_PAGE_SIZE,
2222
})
2323
),
2424
page_index: schema.maybe(

0 commit comments

Comments
 (0)