From 4c1428377a33349b115fff1d7b4a3a0c03bf7ea3 Mon Sep 17 00:00:00 2001
From: Shahzad
Date: Tue, 15 Aug 2023 16:31:24 +0200
Subject: [PATCH 1/7] [Uptime] Use stack version to determine appending
synthetics-* (#163800)
Co-authored-by: Abdul Wahab Zahid
---
.../sections/rule_form/rule_form.tsx | 1 +
.../triggers_actions_ui/public/types.ts | 1 +
.../uptime/common/runtime_types/alerts/tls.ts | 1 +
.../alert_monitor_status.tsx | 10 +++
.../alerts/alerts_containers/alert_tls.tsx | 10 ++-
.../alerts/anomaly_alert/anomaly_alert.tsx | 10 ++-
.../legacy_uptime/lib/alert_types/index.ts | 1 +
.../lazy_wrapper/duration_anomaly.tsx | 5 +-
.../lazy_wrapper/monitor_status.tsx | 9 ++-
.../alert_types/lazy_wrapper/tls_alert.tsx | 18 +++++-
.../lib/alert_types/monitor_status.tsx | 3 +-
.../legacy_uptime/lib/alert_types/tls.tsx | 1 +
x-pack/plugins/uptime/public/plugin.ts | 17 ++++--
.../lib/alerts/duration_anomaly.ts | 3 +-
.../lib/alerts/status_check.test.ts | 1 +
.../legacy_uptime/lib/alerts/status_check.ts | 6 +-
.../server/legacy_uptime/lib/alerts/tls.ts | 3 +-
.../legacy_uptime/lib/alerts/tls_legacy.ts | 2 +-
.../server/legacy_uptime/lib/lib.test.ts | 61 +++++++++++++++++--
.../uptime/server/legacy_uptime/lib/lib.ts | 26 +++++---
20 files changed, 159 insertions(+), 30 deletions(-)
diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_form/rule_form.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_form/rule_form.tsx
index 8170108aeabb5..c72dced42a2d9 100644
--- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_form/rule_form.tsx
+++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_form/rule_form.tsx
@@ -573,6 +573,7 @@ export const RuleForm = ({
}
>
,
ActionGroupIds extends string = string
> {
+ id?: string;
ruleParams: Params;
ruleInterval: string;
ruleThrottle: string;
diff --git a/x-pack/plugins/uptime/common/runtime_types/alerts/tls.ts b/x-pack/plugins/uptime/common/runtime_types/alerts/tls.ts
index 564485d44f239..f4fd375f13ee6 100644
--- a/x-pack/plugins/uptime/common/runtime_types/alerts/tls.ts
+++ b/x-pack/plugins/uptime/common/runtime_types/alerts/tls.ts
@@ -8,6 +8,7 @@
import * as t from 'io-ts';
export const TLSParamsType = t.partial({
+ stackVersion: t.string,
search: t.string,
certAgeThreshold: t.number,
certExpirationThreshold: t.number,
diff --git a/x-pack/plugins/uptime/public/legacy_uptime/components/overview/alerts/alerts_containers/alert_monitor_status.tsx b/x-pack/plugins/uptime/public/legacy_uptime/components/overview/alerts/alerts_containers/alert_monitor_status.tsx
index 54a8010e30a1c..1b1a2f13b2df4 100644
--- a/x-pack/plugins/uptime/public/legacy_uptime/components/overview/alerts/alerts_containers/alert_monitor_status.tsx
+++ b/x-pack/plugins/uptime/public/legacy_uptime/components/overview/alerts/alerts_containers/alert_monitor_status.tsx
@@ -22,6 +22,8 @@ import { FILTER_FIELDS } from '../../../../../../common/constants';
const { TYPE, TAGS, LOCATION, PORT } = FILTER_FIELDS;
interface Props {
+ id?: string;
+ stackVersion?: string;
ruleParams: { [key: string]: any };
enabled: boolean;
numTimes: number;
@@ -33,11 +35,13 @@ interface Props {
}
export const AlertMonitorStatus: React.FC = ({
+ id,
enabled,
numTimes,
setRuleParams,
timerange,
ruleParams,
+ stackVersion,
}) => {
const dispatch = useDispatch();
@@ -47,6 +51,12 @@ export const AlertMonitorStatus: React.FC = ({
}
}, [ruleParams, dispatch]);
+ useEffect(() => {
+ if (!id && stackVersion && !ruleParams.stackVersion) {
+ setRuleParams('stackVersion', stackVersion);
+ }
+ }, [ruleParams, id, stackVersion, setRuleParams]);
+
const { count, loading } = useSnapShotCount({
query: ruleParams.search,
filters: ruleParams.filters,
diff --git a/x-pack/plugins/uptime/public/legacy_uptime/components/overview/alerts/alerts_containers/alert_tls.tsx b/x-pack/plugins/uptime/public/legacy_uptime/components/overview/alerts/alerts_containers/alert_tls.tsx
index 6c7eb5008611b..547242baa15e4 100644
--- a/x-pack/plugins/uptime/public/legacy_uptime/components/overview/alerts/alerts_containers/alert_tls.tsx
+++ b/x-pack/plugins/uptime/public/legacy_uptime/components/overview/alerts/alerts_containers/alert_tls.tsx
@@ -19,9 +19,11 @@ import { AlertQueryBar } from '../alert_query_bar/query_bar';
import { AlertMonitorCount } from '../monitor_status_alert/alert_monitor_status';
export const AlertTls: React.FC<{
+ id?: string;
+ stackVersion?: string;
ruleParams: RuleTypeParamsExpressionProps['ruleParams'];
setRuleParams: RuleTypeParamsExpressionProps['setRuleParams'];
-}> = ({ ruleParams, setRuleParams }) => {
+}> = ({ id, stackVersion, ruleParams, setRuleParams }) => {
const dispatch = useDispatch();
const { settings } = useSelector(selectDynamicSettings);
@@ -30,6 +32,12 @@ export const AlertTls: React.FC<{
query: ruleParams.search ?? '',
});
+ useEffect(() => {
+ if (!id && stackVersion && !ruleParams.stackVersion) {
+ setRuleParams('stackVersion', stackVersion);
+ }
+ }, [ruleParams, id, stackVersion, setRuleParams]);
+
useEffect(() => {
if (typeof settings === 'undefined') {
dispatch(getDynamicSettings());
diff --git a/x-pack/plugins/uptime/public/legacy_uptime/components/overview/alerts/anomaly_alert/anomaly_alert.tsx b/x-pack/plugins/uptime/public/legacy_uptime/components/overview/alerts/anomaly_alert/anomaly_alert.tsx
index c4f37cfa65ff2..f011ce415bcde 100644
--- a/x-pack/plugins/uptime/public/legacy_uptime/components/overview/alerts/anomaly_alert/anomaly_alert.tsx
+++ b/x-pack/plugins/uptime/public/legacy_uptime/components/overview/alerts/anomaly_alert/anomaly_alert.tsx
@@ -26,11 +26,13 @@ import { DEFAULT_SEVERITY, SelectSeverity, SEVERITY_OPTIONS } from './select_sev
import { monitorIdSelector } from '../../../../state/selectors';
interface Props {
+ id?: string;
+ stackVersion?: string;
ruleParams: { [key: string]: any };
setRuleParams: (key: string, value: any) => void;
}
-export function AnomalyAlertComponent({ setRuleParams, ruleParams }: Props) {
+export function AnomalyAlertComponent({ setRuleParams, ruleParams, id, stackVersion }: Props) {
const [severity, setSeverity] = useState(DEFAULT_SEVERITY);
const monitorIdStore = useSelector(monitorIdSelector);
@@ -45,6 +47,12 @@ export function AnomalyAlertComponent({ setRuleParams, ruleParams }: Props) {
setRuleParams('severity', severity.val);
}, [severity, setRuleParams]);
+ useEffect(() => {
+ if (!id && stackVersion && !ruleParams.stackVersion) {
+ setRuleParams('stackVersion', stackVersion);
+ }
+ }, [ruleParams, id, stackVersion, setRuleParams]);
+
useEffect(() => {
if (ruleParams.severity !== undefined) {
setSeverity(SEVERITY_OPTIONS.find(({ val }) => val === ruleParams.severity)!);
diff --git a/x-pack/plugins/uptime/public/legacy_uptime/lib/alert_types/index.ts b/x-pack/plugins/uptime/public/legacy_uptime/lib/alert_types/index.ts
index 06ce0e73084ee..56c1a368fb1e7 100644
--- a/x-pack/plugins/uptime/public/legacy_uptime/lib/alert_types/index.ts
+++ b/x-pack/plugins/uptime/public/legacy_uptime/lib/alert_types/index.ts
@@ -16,6 +16,7 @@ import { initDurationAnomalyAlertType } from './duration_anomaly';
export type AlertTypeInitializer = (dependencies: {
isHidden: boolean;
+ stackVersion: string;
core: CoreStart;
plugins: ClientPluginsStart;
}) => TAlertTypeModel;
diff --git a/x-pack/plugins/uptime/public/legacy_uptime/lib/alert_types/lazy_wrapper/duration_anomaly.tsx b/x-pack/plugins/uptime/public/legacy_uptime/lib/alert_types/lazy_wrapper/duration_anomaly.tsx
index 44c10f615543e..c1ee713206029 100644
--- a/x-pack/plugins/uptime/public/legacy_uptime/lib/alert_types/lazy_wrapper/duration_anomaly.tsx
+++ b/x-pack/plugins/uptime/public/legacy_uptime/lib/alert_types/lazy_wrapper/duration_anomaly.tsx
@@ -18,15 +18,16 @@ interface Props {
core: CoreStart;
plugins: ClientPluginsStart;
params: any;
+ stackVersion?: string;
}
// eslint-disable-next-line import/no-default-export
-export default function DurationAnomalyAlert({ core, plugins, params }: Props) {
+export default function DurationAnomalyAlert({ core, plugins, params, stackVersion }: Props) {
kibanaService.core = core;
return (
-
+
);
diff --git a/x-pack/plugins/uptime/public/legacy_uptime/lib/alert_types/lazy_wrapper/monitor_status.tsx b/x-pack/plugins/uptime/public/legacy_uptime/lib/alert_types/lazy_wrapper/monitor_status.tsx
index dd41ab29ed080..ca745ef5fc390 100644
--- a/x-pack/plugins/uptime/public/legacy_uptime/lib/alert_types/lazy_wrapper/monitor_status.tsx
+++ b/x-pack/plugins/uptime/public/legacy_uptime/lib/alert_types/lazy_wrapper/monitor_status.tsx
@@ -19,16 +19,21 @@ interface Props {
core: CoreStart;
plugins: ClientPluginsStart;
params: any;
+ stackVersion?: string;
}
// eslint-disable-next-line import/no-default-export
-export default function MonitorStatusAlert({ core, plugins, params }: Props) {
+export default function MonitorStatusAlert({ core, plugins, params, stackVersion }: Props) {
kibanaService.core = core;
return (
-
+
diff --git a/x-pack/plugins/uptime/public/legacy_uptime/lib/alert_types/lazy_wrapper/tls_alert.tsx b/x-pack/plugins/uptime/public/legacy_uptime/lib/alert_types/lazy_wrapper/tls_alert.tsx
index bf1affd707859..a9c315bf09451 100644
--- a/x-pack/plugins/uptime/public/legacy_uptime/lib/alert_types/lazy_wrapper/tls_alert.tsx
+++ b/x-pack/plugins/uptime/public/legacy_uptime/lib/alert_types/lazy_wrapper/tls_alert.tsx
@@ -18,6 +18,8 @@ import { kibanaService } from '../../../state/kibana_service';
import { UptimeDataViewContextProvider } from '../../../contexts/uptime_data_view_context';
interface Props {
+ id?: string;
+ stackVersion?: string;
core: CoreStart;
plugins: ClientPluginsStart;
ruleParams: RuleTypeParamsExpressionProps['ruleParams'];
@@ -25,13 +27,25 @@ interface Props {
}
// eslint-disable-next-line import/no-default-export
-export default function TLSAlert({ core, plugins, ruleParams, setRuleParams }: Props) {
+export default function TLSAlert({
+ id,
+ stackVersion,
+ core,
+ plugins,
+ ruleParams,
+ setRuleParams,
+}: Props) {
kibanaService.core = core;
return (
-
+
diff --git a/x-pack/plugins/uptime/public/legacy_uptime/lib/alert_types/monitor_status.tsx b/x-pack/plugins/uptime/public/legacy_uptime/lib/alert_types/monitor_status.tsx
index c42b3a0d8a952..4d346e77e4ebe 100644
--- a/x-pack/plugins/uptime/public/legacy_uptime/lib/alert_types/monitor_status.tsx
+++ b/x-pack/plugins/uptime/public/legacy_uptime/lib/alert_types/monitor_status.tsx
@@ -33,6 +33,7 @@ export const initMonitorStatusAlertType: AlertTypeInitializer = ({
core,
plugins,
isHidden,
+ stackVersion,
}): ObservabilityRuleTypeModel => ({
id: CLIENT_ALERT_TYPES.MONITOR_STATUS,
description,
@@ -41,7 +42,7 @@ export const initMonitorStatusAlertType: AlertTypeInitializer = ({
return `${docLinks.links.observability.monitorStatus}`;
},
ruleParamsExpression: (params: any) => (
-
+
),
validate: (ruleParams: any) => {
if (!validateFunc) {
diff --git a/x-pack/plugins/uptime/public/legacy_uptime/lib/alert_types/tls.tsx b/x-pack/plugins/uptime/public/legacy_uptime/lib/alert_types/tls.tsx
index a80c4567335bb..9fe475ed5ef87 100644
--- a/x-pack/plugins/uptime/public/legacy_uptime/lib/alert_types/tls.tsx
+++ b/x-pack/plugins/uptime/public/legacy_uptime/lib/alert_types/tls.tsx
@@ -35,6 +35,7 @@ export const initTlsAlertType: AlertTypeInitializer = ({
diff --git a/x-pack/plugins/uptime/public/plugin.ts b/x-pack/plugins/uptime/public/plugin.ts
index 7a13252327a90..8162e6991d26f 100644
--- a/x-pack/plugins/uptime/public/plugin.ts
+++ b/x-pack/plugins/uptime/public/plugin.ts
@@ -213,7 +213,12 @@ export class UptimePlugin
setStartServices(coreStart);
registerUptimeFleetExtensions(registerExtension);
- setUptimeAppStatus(coreStart, pluginsStart, this.uptimeAppUpdater);
+ setUptimeAppStatus(
+ this.initContext.env.packageInfo.version,
+ coreStart,
+ pluginsStart,
+ this.uptimeAppUpdater
+ );
}
public stop(): void {}
@@ -275,6 +280,7 @@ function registerUptimeFleetExtensions(registerExtension: FleetStart['registerEx
}
function setUptimeAppStatus(
+ stackVersion: string,
coreStart: CoreStart,
pluginsStart: ClientPluginsStart,
updater: BehaviorSubject
@@ -283,7 +289,7 @@ function setUptimeAppStatus(
const isEnabled = coreStart.uiSettings.get(enableLegacyUptimeApp);
if (isEnabled) {
registerUptimeRoutesWithNavigation(coreStart, pluginsStart);
- registerAlertRules(coreStart, pluginsStart, false);
+ registerAlertRules(coreStart, pluginsStart, stackVersion, false);
updater.next(() => ({ status: AppStatus.accessible }));
} else {
const indexStatusPromise = UptimeDataHelper(coreStart).indexStatus('now-7d', 'now');
@@ -291,10 +297,10 @@ function setUptimeAppStatus(
if (indexStatus.indexExists) {
registerUptimeRoutesWithNavigation(coreStart, pluginsStart);
updater.next(() => ({ status: AppStatus.accessible }));
- registerAlertRules(coreStart, pluginsStart, false);
+ registerAlertRules(coreStart, pluginsStart, stackVersion, false);
} else {
updater.next(() => ({ status: AppStatus.inaccessible }));
- registerAlertRules(coreStart, pluginsStart, true);
+ registerAlertRules(coreStart, pluginsStart, stackVersion, true);
}
});
}
@@ -304,6 +310,7 @@ function setUptimeAppStatus(
function registerAlertRules(
coreStart: CoreStart,
pluginsStart: ClientPluginsStart,
+ stackVersion: string,
isHidden = false
) {
uptimeAlertTypeInitializers.forEach((init) => {
@@ -311,6 +318,7 @@ function registerAlertRules(
const alertInitializer = init({
isHidden,
+ stackVersion,
core: coreStart,
plugins: pluginsStart,
});
@@ -322,6 +330,7 @@ function registerAlertRules(
legacyAlertTypeInitializers.forEach((init) => {
const alertInitializer = init({
isHidden,
+ stackVersion,
core: coreStart,
plugins: pluginsStart,
});
diff --git a/x-pack/plugins/uptime/server/legacy_uptime/lib/alerts/duration_anomaly.ts b/x-pack/plugins/uptime/server/legacy_uptime/lib/alerts/duration_anomaly.ts
index 870272fcbe402..2a756f316731e 100644
--- a/x-pack/plugins/uptime/server/legacy_uptime/lib/alerts/duration_anomaly.ts
+++ b/x-pack/plugins/uptime/server/legacy_uptime/lib/alerts/duration_anomaly.ts
@@ -104,6 +104,7 @@ export const durationAnomalyAlertFactory: UptimeAlertTypeFactory
name: durationAnomalyTranslations.alertFactoryName,
validate: {
params: schema.object({
+ stackVersion: schema.maybe(schema.string()),
monitorId: schema.string(),
severity: schema.number(),
}),
@@ -146,7 +147,7 @@ export const durationAnomalyAlertFactory: UptimeAlertTypeFactory
savedObjectsClient,
scopedClusterClient.asCurrentUser,
{
- isLegacyAlert: true,
+ stackVersion: params.stackVersion ?? '8.9.0',
}
);
const { share, basePath } = server;
diff --git a/x-pack/plugins/uptime/server/legacy_uptime/lib/alerts/status_check.test.ts b/x-pack/plugins/uptime/server/legacy_uptime/lib/alerts/status_check.test.ts
index aa243e5265070..8755427253369 100644
--- a/x-pack/plugins/uptime/server/legacy_uptime/lib/alerts/status_check.test.ts
+++ b/x-pack/plugins/uptime/server/legacy_uptime/lib/alerts/status_check.test.ts
@@ -1069,6 +1069,7 @@ describe('status check alert', () => {
// @ts-ignore the `props` key here isn't described
expect(Object.keys(alert.validate?.params?.props ?? {})).toMatchInlineSnapshot(`
Array [
+ "stackVersion",
"availability",
"filters",
"locations",
diff --git a/x-pack/plugins/uptime/server/legacy_uptime/lib/alerts/status_check.ts b/x-pack/plugins/uptime/server/legacy_uptime/lib/alerts/status_check.ts
index 18de47f44ac87..3d45641fa1406 100644
--- a/x-pack/plugins/uptime/server/legacy_uptime/lib/alerts/status_check.ts
+++ b/x-pack/plugins/uptime/server/legacy_uptime/lib/alerts/status_check.ts
@@ -286,6 +286,7 @@ export const statusCheckAlertFactory: UptimeAlertTypeFactory = (
}),
validate: {
params: schema.object({
+ stackVersion: schema.maybe(schema.string()),
availability: schema.maybe(
schema.object({
range: schema.number(),
@@ -293,6 +294,7 @@ export const statusCheckAlertFactory: UptimeAlertTypeFactory = (
threshold: schema.string(),
})
),
+ // deprecated
filters: schema.maybe(
schema.oneOf([
// deprecated
@@ -305,7 +307,6 @@ export const statusCheckAlertFactory: UptimeAlertTypeFactory = (
schema.string(),
])
),
- // deprecated
locations: schema.maybe(schema.arrayOf(schema.string())),
numTimes: schema.number(),
search: schema.maybe(schema.string()),
@@ -362,6 +363,7 @@ export const statusCheckAlertFactory: UptimeAlertTypeFactory = (
startedAt,
}) {
const {
+ stackVersion = '8.9.0',
availability,
filters,
isAutoGenerated,
@@ -380,7 +382,7 @@ export const statusCheckAlertFactory: UptimeAlertTypeFactory = (
savedObjectsClient,
scopedClusterClient.asCurrentUser,
{
- isLegacyAlert: true,
+ stackVersion,
}
);
diff --git a/x-pack/plugins/uptime/server/legacy_uptime/lib/alerts/tls.ts b/x-pack/plugins/uptime/server/legacy_uptime/lib/alerts/tls.ts
index f84ec4ed8589f..2365788545775 100644
--- a/x-pack/plugins/uptime/server/legacy_uptime/lib/alerts/tls.ts
+++ b/x-pack/plugins/uptime/server/legacy_uptime/lib/alerts/tls.ts
@@ -121,6 +121,7 @@ export const tlsAlertFactory: UptimeAlertTypeFactory = (
name: tlsTranslations.alertFactoryName,
validate: {
params: schema.object({
+ stackVersion: schema.maybe(schema.string()),
search: schema.maybe(schema.string()),
certExpirationThreshold: schema.maybe(schema.number()),
certAgeThreshold: schema.maybe(schema.number()),
@@ -168,7 +169,7 @@ export const tlsAlertFactory: UptimeAlertTypeFactory = (
savedObjectsClient,
scopedClusterClient.asCurrentUser,
{
- isLegacyAlert: true,
+ stackVersion: params.stackVersion ?? '8.9.0',
}
);
diff --git a/x-pack/plugins/uptime/server/legacy_uptime/lib/alerts/tls_legacy.ts b/x-pack/plugins/uptime/server/legacy_uptime/lib/alerts/tls_legacy.ts
index 4393e4fde3e71..9786a7a844c45 100644
--- a/x-pack/plugins/uptime/server/legacy_uptime/lib/alerts/tls_legacy.ts
+++ b/x-pack/plugins/uptime/server/legacy_uptime/lib/alerts/tls_legacy.ts
@@ -120,7 +120,7 @@ export const tlsLegacyAlertFactory: UptimeAlertTypeFactory = (_s
savedObjectsClient,
scopedClusterClient.asCurrentUser,
{
- isLegacyAlert: true,
+ stackVersion: '8.9.0',
}
);
const { certs, total }: CertResult = await libs.requests.getCerts({
diff --git a/x-pack/plugins/uptime/server/legacy_uptime/lib/lib.test.ts b/x-pack/plugins/uptime/server/legacy_uptime/lib/lib.test.ts
index de101bed4e037..e55898cf7a63d 100644
--- a/x-pack/plugins/uptime/server/legacy_uptime/lib/lib.test.ts
+++ b/x-pack/plugins/uptime/server/legacy_uptime/lib/lib.test.ts
@@ -147,7 +147,7 @@ describe('UptimeEsClient', () => {
syntheticsIndexRemoved: true,
},
});
- uptimeEsClient = new UptimeEsClient(savedObjectsClient, esClient, { isLegacyAlert: true });
+ uptimeEsClient = new UptimeEsClient(savedObjectsClient, esClient, { stackVersion: '8.9.0' });
const mockSearchParams = {
body: {
@@ -180,7 +180,7 @@ describe('UptimeEsClient', () => {
settingsObjectId
);
});
- uptimeEsClient = new UptimeEsClient(savedObjectsClient, esClient, { isLegacyAlert: true });
+ uptimeEsClient = new UptimeEsClient(savedObjectsClient, esClient, { stackVersion: '8.9.0' });
const mockSearchParams = {
body: {
@@ -206,7 +206,60 @@ describe('UptimeEsClient', () => {
{ meta: true }
);
});
- });
+ it('does not append synthetics-* to index for stack version 8.10.0 or later', async () => {
+ savedObjectsClient.get = jest.fn().mockImplementation(() => {
+ throw SavedObjectsErrorHelpers.createGenericNotFoundError(
+ umDynamicSettings.name,
+ settingsObjectId
+ );
+ });
+ uptimeEsClient = new UptimeEsClient(savedObjectsClient, esClient, {
+ stackVersion: '8.11.0',
+ });
+
+ await uptimeEsClient.search({
+ body: {
+ query: {
+ match_all: {},
+ },
+ },
+ });
+
+ expect(esClient.search).toHaveBeenCalledWith(
+ {
+ index: 'heartbeat-8*,heartbeat-7*',
+ body: {
+ query: {
+ match_all: {},
+ },
+ },
+ },
+ { meta: true }
+ );
- // Add more tests for other methods and edge cases
+ uptimeEsClient = new UptimeEsClient(savedObjectsClient, esClient, {
+ stackVersion: '8.10.0',
+ });
+
+ await uptimeEsClient.search({
+ body: {
+ query: {
+ match_all: {},
+ },
+ },
+ });
+
+ expect(esClient.search).toHaveBeenLastCalledWith(
+ {
+ index: 'heartbeat-8*,heartbeat-7*',
+ body: {
+ query: {
+ match_all: {},
+ },
+ },
+ },
+ { meta: true }
+ );
+ });
+ });
});
diff --git a/x-pack/plugins/uptime/server/legacy_uptime/lib/lib.ts b/x-pack/plugins/uptime/server/legacy_uptime/lib/lib.ts
index 32c8e085cdf48..9008ff9b33100 100644
--- a/x-pack/plugins/uptime/server/legacy_uptime/lib/lib.ts
+++ b/x-pack/plugins/uptime/server/legacy_uptime/lib/lib.ts
@@ -19,6 +19,7 @@ import { RequestStatus } from '@kbn/inspector-plugin/common';
import { InspectResponse } from '@kbn/observability-plugin/typings/common';
import { enableInspectEsQueries } from '@kbn/observability-plugin/common';
import { getInspectResponse } from '@kbn/observability-shared-plugin/common';
+import semver from 'semver/preload';
import { DYNAMIC_SETTINGS_DEFAULT_ATTRIBUTES } from '../../constants/settings';
import { DynamicSettingsAttributes } from '../../runtime_types/settings';
import { settingsObjectId, umDynamicSettings } from './saved_objects/uptime_settings';
@@ -52,6 +53,7 @@ export class UptimeEsClient {
uiSettings?: CoreRequestHandlerContext['uiSettings'];
savedObjectsClient: SavedObjectsClientContract;
isLegacyAlert?: boolean;
+ stackVersion?: string;
constructor(
savedObjectsClient: SavedObjectsClientContract,
@@ -61,17 +63,17 @@ export class UptimeEsClient {
uiSettings?: CoreRequestHandlerContext['uiSettings'];
request?: KibanaRequest;
heartbeatIndices?: string;
- isLegacyAlert?: boolean;
+ stackVersion?: string;
}
) {
const {
- isLegacyAlert,
+ stackVersion,
isDev = false,
uiSettings,
request,
heartbeatIndices = '',
} = options ?? {};
- this.isLegacyAlert = isLegacyAlert;
+ this.stackVersion = stackVersion;
this.uiSettings = uiSettings;
this.baseESClient = esClient;
this.savedObjectsClient = savedObjectsClient;
@@ -225,17 +227,25 @@ export class UptimeEsClient {
indices = settings?.heartbeatIndices || '';
syntheticsIndexRemoved = settings.syntheticsIndexRemoved ?? false;
}
- if (
- this.isLegacyAlert &&
- !indices.includes('synthetics-') &&
- (syntheticsIndexRemoved || !settingsChangedByUser)
- ) {
+ if (indices.includes('synthetics-')) {
+ return indices;
+ }
+ const appendSyntheticsIndex = shouldAppendSyntheticsIndex(this.stackVersion);
+
+ if (appendSyntheticsIndex && (syntheticsIndexRemoved || !settingsChangedByUser)) {
indices = indices + ',synthetics-*';
}
return indices;
}
}
+export const shouldAppendSyntheticsIndex = (stackVersion?: string) => {
+ if (!stackVersion) {
+ return false;
+ }
+ return semver.lt(stackVersion, '8.10.0');
+};
+
export function createEsParams(params: T): T {
return params;
}
From 53d2275c9e5c68fd9679fa11b85fd35f4dec54c3 Mon Sep 17 00:00:00 2001
From: Francesco Gualazzi
Date: Tue, 15 Aug 2023 16:47:52 +0200
Subject: [PATCH 2/7] Profiling: amend Add Data page instructions with stack
release versions (#163884)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
## Summary
* amend the "Add Data" page to use artifacts download URLs from the
official channels
* fetch and propagate stack version of Kibana in the instructions, to
bind stack version on the agent
* minor correction to the package titles to display nicer names in Fleet
agent page
### Checklist
Delete any items that are not applicable to this PR.
- [X] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [X]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [X] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [X] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [X] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)
### For maintainers
- [X] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
---------
Signed-off-by: inge4pres
Co-authored-by: Cauê Hironimuz Marcondes
---
.../public/components/check_setup.tsx | 4 +-
.../missing_symbols_callout.tsx | 4 +-
.../profiling_header_action_menu.tsx | 4 +-
.../profiling/public/routing/index.tsx | 20 +--
.../{no_data_view => add_data_view}/index.tsx | 114 ++++++++++--------
.../server/lib/setup/fleet_policies.ts | 8 +-
.../lib/setup/get_setup_instructions.ts | 5 +
x-pack/plugins/profiling/server/plugin.ts | 2 +
.../plugins/profiling/server/routes/index.ts | 1 +
.../plugins/profiling/server/routes/setup.ts | 6 +-
.../translations/translations/fr-FR.json | 7 --
.../translations/translations/ja-JP.json | 7 --
.../translations/translations/zh-CN.json | 7 --
13 files changed, 98 insertions(+), 91 deletions(-)
rename x-pack/plugins/profiling/public/views/{no_data_view => add_data_view}/index.tsx (83%)
diff --git a/x-pack/plugins/profiling/public/components/check_setup.tsx b/x-pack/plugins/profiling/public/components/check_setup.tsx
index cdd7e0bcd3ccc..e5b7993845323 100644
--- a/x-pack/plugins/profiling/public/components/check_setup.tsx
+++ b/x-pack/plugins/profiling/public/components/check_setup.tsx
@@ -21,7 +21,7 @@ import { useHistory } from 'react-router-dom';
import { AsyncStatus, useAsync } from '../hooks/use_async';
import { useAutoAbortedHttpClient } from '../hooks/use_auto_aborted_http_client';
import { useProfilingRouter } from '../hooks/use_profiling_router';
-import { NoDataTabs } from '../views/no_data_view';
+import { AddDataTabs } from '../views/add_data_view';
import { useLicenseContext } from './contexts/license/use_license_context';
import { useProfilingDependencies } from './contexts/profiling_dependencies/use_profiling_dependencies';
import { LicensePrompt } from './license_prompt';
@@ -209,7 +209,7 @@ export function CheckSetup({ children }: { children: React.ReactElement }) {
// when there's no data redirect the user to the add data instructions page
router.push('/add-data-instructions', {
path: {},
- query: { selectedTab: NoDataTabs.Kubernetes },
+ query: { selectedTab: AddDataTabs.Kubernetes },
});
return null;
}
diff --git a/x-pack/plugins/profiling/public/components/frame_information_window/missing_symbols_callout.tsx b/x-pack/plugins/profiling/public/components/frame_information_window/missing_symbols_callout.tsx
index a7d2d1dce6a1c..ff86ba5628c27 100644
--- a/x-pack/plugins/profiling/public/components/frame_information_window/missing_symbols_callout.tsx
+++ b/x-pack/plugins/profiling/public/components/frame_information_window/missing_symbols_callout.tsx
@@ -13,7 +13,7 @@ import { FrameType, getLanguageType } from '../../../common/profiling';
import { PROFILING_FEEDBACK_LINK } from '../profiling_app_page_template';
import { useProfilingDependencies } from '../contexts/profiling_dependencies/use_profiling_dependencies';
import { useProfilingRouter } from '../../hooks/use_profiling_router';
-import { NoDataTabs } from '../../views/no_data_view';
+import { AddDataTabs } from '../../views/add_data_view';
interface Props {
frameType: FrameType;
@@ -55,7 +55,7 @@ export function MissingSymbolsCallout({ frameType }: Props) {
diff --git a/x-pack/plugins/profiling/public/components/profiling_header_action_menu.tsx b/x-pack/plugins/profiling/public/components/profiling_header_action_menu.tsx
index be823c583fa21..3a6945f7f2d7f 100644
--- a/x-pack/plugins/profiling/public/components/profiling_header_action_menu.tsx
+++ b/x-pack/plugins/profiling/public/components/profiling_header_action_menu.tsx
@@ -12,7 +12,7 @@ import { useHistory } from 'react-router-dom';
import url from 'url';
import { ObservabilityAIAssistantActionMenuItem } from '@kbn/observability-ai-assistant-plugin/public';
import { useProfilingRouter } from '../hooks/use_profiling_router';
-import { NoDataTabs } from '../views/no_data_view';
+import { AddDataTabs } from '../views/add_data_view';
export function ProfilingHeaderActionMenu() {
const router = useProfilingRouter();
@@ -48,7 +48,7 @@ export function ProfilingHeaderActionMenu() {
diff --git a/x-pack/plugins/profiling/public/routing/index.tsx b/x-pack/plugins/profiling/public/routing/index.tsx
index 3bbd6c482c9ae..db2a22f357580 100644
--- a/x-pack/plugins/profiling/public/routing/index.tsx
+++ b/x-pack/plugins/profiling/public/routing/index.tsx
@@ -23,7 +23,7 @@ import { FlameGraphView } from '../views/flamegraphs/flamegraph';
import { FunctionsView } from '../views/functions';
import { DifferentialTopNFunctionsView } from '../views/functions/differential_topn';
import { TopNFunctionsView } from '../views/functions/topn';
-import { NoDataTabs, NoDataView } from '../views/no_data_view';
+import { AddDataTabs, AddDataView } from '../views/add_data_view';
import { StackTracesView } from '../views/stack_traces_view';
import { StorageExplorerView } from '../views/storage_explorer';
import { RouteBreadcrumb } from './route_breadcrumb';
@@ -42,23 +42,23 @@ const routes = {
),
children: {
'/add-data-instructions': {
- element: ,
+ element: ,
params: t.type({
query: t.type({
selectedTab: t.union([
- t.literal(NoDataTabs.Binary),
- t.literal(NoDataTabs.Deb),
- t.literal(NoDataTabs.Docker),
- t.literal(NoDataTabs.ElasticAgentIntegration),
- t.literal(NoDataTabs.Kubernetes),
- t.literal(NoDataTabs.RPM),
- t.literal(NoDataTabs.Symbols),
+ t.literal(AddDataTabs.Binary),
+ t.literal(AddDataTabs.Deb),
+ t.literal(AddDataTabs.Docker),
+ t.literal(AddDataTabs.ElasticAgentIntegration),
+ t.literal(AddDataTabs.Kubernetes),
+ t.literal(AddDataTabs.RPM),
+ t.literal(AddDataTabs.Symbols),
]),
}),
}),
defaults: {
query: {
- selectedTab: NoDataTabs.Kubernetes,
+ selectedTab: AddDataTabs.Kubernetes,
},
},
},
diff --git a/x-pack/plugins/profiling/public/views/no_data_view/index.tsx b/x-pack/plugins/profiling/public/views/add_data_view/index.tsx
similarity index 83%
rename from x-pack/plugins/profiling/public/views/no_data_view/index.tsx
rename to x-pack/plugins/profiling/public/views/add_data_view/index.tsx
index c50f50d3170ed..31332c20e1262 100644
--- a/x-pack/plugins/profiling/public/views/no_data_view/index.tsx
+++ b/x-pack/plugins/profiling/public/views/add_data_view/index.tsx
@@ -25,6 +25,7 @@ import {
EuiText,
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
+import major from 'semver/functions/major';
import { useProfilingParams } from '../../hooks/use_profiling_params';
import { useProfilingRouter } from '../../hooks/use_profiling_router';
import { useProfilingRoutePath } from '../../hooks/use_profiling_route_path';
@@ -32,7 +33,7 @@ import { AsyncStatus, useAsync } from '../../hooks/use_async';
import { useProfilingDependencies } from '../../components/contexts/profiling_dependencies/use_profiling_dependencies';
import { ProfilingAppPageTemplate } from '../../components/profiling_app_page_template';
-export enum NoDataTabs {
+export enum AddDataTabs {
Kubernetes = 'kubernetes',
Docker = 'docker',
Binary = 'binary',
@@ -42,7 +43,7 @@ export enum NoDataTabs {
Symbols = 'symbols',
}
-export function NoDataView() {
+export function AddDataView() {
const { query } = useProfilingParams('/add-data-instructions');
const { selectedTab } = query;
const profilingRouter = useProfilingRouter();
@@ -63,11 +64,12 @@ export function NoDataView() {
const secretToken = data?.collector?.secretToken;
const collectionAgentHost = data?.collector?.host;
const symbolUrl = data?.symbolizer?.host;
- const hostAgentVersion = 'v3';
+ const stackVersion = data?.stackVersion!;
+ const majorVersion = stackVersion ? major(stackVersion).toString() : undefined;
const tabs = [
{
- key: NoDataTabs.Kubernetes,
+ key: AddDataTabs.Kubernetes,
title: i18n.translate('xpack.profiling.tabs.kubernetesTitle', {
defaultMessage: 'Kubernetes',
}),
@@ -78,7 +80,7 @@ export function NoDataView() {
}),
content: (
- helm repo add optimyze https://optimyze.cloud/helm-charts
+ helm repo add elastic https://helm.elastic.co
),
},
@@ -91,8 +93,9 @@ export function NoDataView() {
{`helm install --create-namespace -n=universal-profiling universal-profiling-agent \\
--set "projectID=1,secretToken=${secretToken}" \\
--set "collectionAgentHostPort=${collectionAgentHost}" \\
---set "version=${hostAgentVersion}" \\
-optimyze/pf-host-agent`}
+--set "version=${stackVersion}" \\
+--version=${stackVersion} \\
+elastic/pf-host-agent`}
),
},
@@ -116,7 +119,7 @@ optimyze/pf-host-agent`}
],
},
{
- key: NoDataTabs.Docker,
+ key: AddDataTabs.Docker,
title: i18n.translate('xpack.profiling.tabs.dockerTitle', {
defaultMessage: 'Docker',
}),
@@ -127,9 +130,9 @@ optimyze/pf-host-agent`}
}),
content: (
- {`docker run --name host-agent --privileged --pid=host -v /etc/machine-id:/etc/machine-id:ro \\
+ {`docker run --name pf-host-agent --privileged --pid=host -v /etc/machine-id:/etc/machine-id:ro \\
-v /var/run/docker.sock:/var/run/docker.sock -v /sys/kernel/debug:/sys/kernel/debug:ro \\
-docker.elastic.co/observability/profiling-agent:${hostAgentVersion} /root/pf-host-agent \\
+docker.elastic.co/observability/profiling-agent:${stackVersion} /root/pf-host-agent \\
-project-id=1 -secret-token=${secretToken} \\
-collection-agent=${collectionAgentHost}`}
@@ -138,19 +141,29 @@ docker.elastic.co/observability/profiling-agent:${hostAgentVersion} /root/pf-hos
],
},
{
- key: NoDataTabs.Binary,
+ key: AddDataTabs.Binary,
title: i18n.translate('xpack.profiling.tabs.binaryTitle', {
defaultMessage: 'Binary',
}),
steps: [
{
title: i18n.translate('xpack.profiling.tabs.binaryDownloadStep', {
- defaultMessage: 'Download the latest binary:',
+ defaultMessage: 'Download the binary for the right architecture:',
}),
content: (
-
- {`wget -O pf-host-agent.tgz "https://ela.st/pf-host-agent-amd64-${hostAgentVersion}" && tar xzf pf-host-agent.tgz`}
-
+
+ For x86_64:
+
+
+ {`wget -O pf-host-agent.tgz "https://artifacts.elastic.co/downloads/prodfiler/pf-host-agent-${stackVersion}-linux-x86_64.tar.gz" && tar xzf pf-host-agent.tgz`}
+
+
+ For ARM64:
+
+
+ {`wget -O pf-host-agent.tgz "https://artifacts.elastic.co/downloads/prodfiler/pf-host-agent-${stackVersion}-linux-arm64.tar.gz" && tar xzf pf-host-agent.tgz`}
+
+
),
},
{
@@ -176,23 +189,22 @@ docker.elastic.co/observability/profiling-agent:${hostAgentVersion} /root/pf-hos
],
},
{
- key: NoDataTabs.Deb,
+ key: AddDataTabs.Deb,
title: i18n.translate('xpack.profiling.tabs.debTitle', {
defaultMessage: 'DEB Package',
}),
steps: [
{
- title: i18n.translate('xpack.profiling.tabs.debDownloadPackageStep', {
- defaultMessage:
- 'Open the URL below and download the right DEB package for your CPU architecture:',
+ title: i18n.translate('xpack.profiling.tabs.debConfigureRepoStep', {
+ defaultMessage: 'Configure the apt repository (requires root privileges):',
}),
content: (
-
- {`https://ela.st/pf-host-agent-linux-${hostAgentVersion}`}
-
+
+ {`wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
+sudo apt-get install apt-transport-https
+echo "deb https://artifacts.elastic.co/packages/${majorVersion}.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-${majorVersion}.x.list
+`}
+
),
},
{
@@ -201,7 +213,7 @@ docker.elastic.co/observability/profiling-agent:${hostAgentVersion} /root/pf-hos
}),
content: (
- {`sudo dpkg -i pf-host-agent*.deb`}
+ {`sudo apt-get update && sudo apt-get install pf-host-agent`}
),
},
@@ -229,23 +241,29 @@ docker.elastic.co/observability/profiling-agent:${hostAgentVersion} /root/pf-hos
],
},
{
- key: NoDataTabs.RPM,
+ key: AddDataTabs.RPM,
title: i18n.translate('xpack.profiling.tabs.rpmTitle', {
defaultMessage: 'RPM Package',
}),
steps: [
{
- title: i18n.translate('xpack.profiling.tabs.rpmDownloadPackageStep', {
- defaultMessage:
- 'Open the URL below and download the right RPM package for your CPU architecture:',
+ title: i18n.translate('xpack.profiling.tabs.rpmConfigureRepoStep', {
+ defaultMessage: 'Configure the yum repository (requires root privileges):',
}),
content: (
-
- {`https://ela.st/pf-host-agent-linux-${hostAgentVersion}`}
-
+
+ {`sudo rpm --import https://packages.elastic.co/GPG-KEY-elasticsearch
+cat < /etc/yum.repos.d/elastic.repo
+[elastic-${majorVersion}.x]
+name=Elastic repository for ${majorVersion}.x packages
+baseurl=https://artifacts.elastic.co/packages/${majorVersion}.x/yum
+gpgcheck=1
+gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
+enabled=1
+autorefresh=1
+type=rpm-md
+EOF`}
+
),
},
{
@@ -254,7 +272,7 @@ docker.elastic.co/observability/profiling-agent:${hostAgentVersion} /root/pf-hos
}),
content: (
- {`sudo rpm -i pf-host-agent*.rpm`}
+ {`sudo yum install pf-host-agent`}
),
},
@@ -282,26 +300,26 @@ docker.elastic.co/observability/profiling-agent:${hostAgentVersion} /root/pf-hos
],
},
{
- key: NoDataTabs.ElasticAgentIntegration,
- title: i18n.translate('xpack.profiling.tabs.elasticAgentIntegrarion.title', {
+ key: AddDataTabs.ElasticAgentIntegration,
+ title: i18n.translate('xpack.profiling.tabs.elasticAgentIntegration.title', {
defaultMessage: 'Elastic Agent Integration',
}),
steps: [
{
- title: i18n.translate('xpack.profiling.tabs.elasticAgentIntegrarion.step1', {
+ title: i18n.translate('xpack.profiling.tabs.elasticAgentIntegration.step1', {
defaultMessage: 'Copy credentials',
}),
content: (
<>
- {i18n.translate('xpack.profiling.tabs.elasticAgentIntegrarion.step1.hint', {
+ {i18n.translate('xpack.profiling.tabs.elasticAgentIntegration.step1.hint', {
defaultMessage:
"You'll need these credentials to set up Universal Profiling. Please save them in a secure location, as they will be required in the subsequent step.",
})}
- {i18n.translate('xpack.profiling.tabs.elasticAgentIntegrarion.step1.secretToken', {
+ {i18n.translate('xpack.profiling.tabs.elasticAgentIntegration.step1.secretToken', {
defaultMessage: 'Secret token:',
})}
@@ -311,7 +329,7 @@ docker.elastic.co/observability/profiling-agent:${hostAgentVersion} /root/pf-hos
{i18n.translate(
- 'xpack.profiling.tabs.elasticAgentIntegrarion.step1.collectionAgentUrl',
+ 'xpack.profiling.tabs.elasticAgentIntegration.step1.collectionAgentUrl',
{ defaultMessage: 'Universal Profiling Collector url:' }
)}
@@ -322,7 +340,7 @@ docker.elastic.co/observability/profiling-agent:${hostAgentVersion} /root/pf-hos
),
},
{
- title: i18n.translate('xpack.profiling.tabs.elasticAgentIntegrarion.step2', {
+ title: i18n.translate('xpack.profiling.tabs.elasticAgentIntegration.step2', {
defaultMessage: 'Fleet',
}),
content: (
@@ -333,7 +351,7 @@ docker.elastic.co/observability/profiling-agent:${hostAgentVersion} /root/pf-hos
`/app/integrations/detail/profiler_agent-${data?.profilerAgent.version}/overview`
)}`}
>
- {i18n.translate('xpack.profiling.tabs.elasticAgentIntegrarion.step2.button', {
+ {i18n.translate('xpack.profiling.tabs.elasticAgentIntegration.step2.button', {
defaultMessage: 'Manage Universal Profiling agent in Fleet',
})}
@@ -342,7 +360,7 @@ docker.elastic.co/observability/profiling-agent:${hostAgentVersion} /root/pf-hos
],
},
{
- key: NoDataTabs.Symbols,
+ key: AddDataTabs.Symbols,
title: i18n.translate('xpack.profiling.tabs.symbols.title', {
defaultMessage: 'Upload Symbols',
}),
@@ -356,13 +374,13 @@ docker.elastic.co/observability/profiling-agent:${hostAgentVersion} /root/pf-hos
For x86_64:
- {`wget -O symbtool-amd64.tgz "https://ela.st/symbtool-linux-amd64" && tar xzf symbtool-amd64.tgz && cd symbtool-*-linux-x86_64`}
+ {`wget -O symbtool-amd64.tgz "https://artifacts.elastic.co/downloads/prodfiler/symbtool-${stackVersion}-linux-x86_64.tar.gz" && tar xzf symbtool-amd64.tgz && cd symbtool-*-linux-x86_64`}
For ARM64:
- {`wget -O symbtool-arm64.tgz "https://ela.st/symbtool-linux-arm64" && tar xzf symbtool-arm64.tgz && cd symbtool-*-linux-arm64`}
+ {`wget -O symbtool-arm64.tgz "https://artifacts.elastic.co/downloads/prodfiler/pf-host-agent-${stackVersion}-linux-arm64.tar.gz" && tar xzf symbtool-arm64.tgz && cd symbtool-*-linux-arm64`}
),
diff --git a/x-pack/plugins/profiling/server/lib/setup/fleet_policies.ts b/x-pack/plugins/profiling/server/lib/setup/fleet_policies.ts
index 8ffe13695cddb..c6ac504042da5 100644
--- a/x-pack/plugins/profiling/server/lib/setup/fleet_policies.ts
+++ b/x-pack/plugins/profiling/server/lib/setup/fleet_policies.ts
@@ -15,8 +15,8 @@ import { ELASTIC_CLOUD_APM_POLICY, getApmPolicy } from './get_apm_policy';
import { ProfilingSetupOptions } from './types';
const CLOUD_AGENT_POLICY_ID = 'policy-elastic-agent-on-cloud';
-const COLLECTOR_PACKAGE_POLICY_NAME = 'elastic-universal-profiling-collector';
-const SYMBOLIZER_PACKAGE_POLICY_NAME = 'elastic-universal-profiling-symbolizer';
+const COLLECTOR_PACKAGE_POLICY_NAME = 'Universal Profiling Collector';
+const SYMBOLIZER_PACKAGE_POLICY_NAME = 'Universal Profiling Symbolizer';
async function getPackagePolicy({
soClient,
@@ -103,7 +103,7 @@ export async function createCollectorPackagePolicy({
enabled: true,
package: {
name: packageName,
- title: 'Universal Profiling Collector',
+ title: COLLECTOR_PACKAGE_POLICY_NAME,
version,
},
name: COLLECTOR_PACKAGE_POLICY_NAME,
@@ -161,7 +161,7 @@ export async function createSymbolizerPackagePolicy({
enabled: true,
package: {
name: packageName,
- title: 'Universal Profiling Symbolizer',
+ title: SYMBOLIZER_PACKAGE_POLICY_NAME,
version,
},
name: SYMBOLIZER_PACKAGE_POLICY_NAME,
diff --git a/x-pack/plugins/profiling/server/lib/setup/get_setup_instructions.ts b/x-pack/plugins/profiling/server/lib/setup/get_setup_instructions.ts
index 31d1ef3f553f1..f21098492e8e8 100644
--- a/x-pack/plugins/profiling/server/lib/setup/get_setup_instructions.ts
+++ b/x-pack/plugins/profiling/server/lib/setup/get_setup_instructions.ts
@@ -21,16 +21,20 @@ export interface SetupDataCollectionInstructions {
profilerAgent: {
version: string;
};
+
+ stackVersion: string;
}
export async function getSetupInstructions({
packagePolicyClient,
soClient,
apmServerHost,
+ stackVersion,
}: {
packagePolicyClient: PackagePolicyClient;
soClient: SavedObjectsClientContract;
apmServerHost?: string;
+ stackVersion: string;
}): Promise {
const profilerAgent = await fetchFindLatestPackageOrThrow('profiler_agent', { prerelease: true });
const collectorPolicy = await getCollectorPolicy({ packagePolicyClient, soClient });
@@ -59,5 +63,6 @@ export async function getSetupInstructions({
profilerAgent: {
version: profilerAgent.version,
},
+ stackVersion,
};
}
diff --git a/x-pack/plugins/profiling/server/plugin.ts b/x-pack/plugins/profiling/server/plugin.ts
index 8cfccee401433..5bb7cfe978cc0 100644
--- a/x-pack/plugins/profiling/server/plugin.ts
+++ b/x-pack/plugins/profiling/server/plugin.ts
@@ -40,6 +40,7 @@ export class ProfilingPlugin
deps.features.registerKibanaFeature(PROFILING_FEATURE);
const config = this.initializerContext.config.get();
+ const stackVersion = this.initializerContext.env.packageInfo.version;
const telemetryUsageCounter = deps.usageCollection?.createUsageCounter(
PROFILING_SERVER_FEATURE_ID
@@ -61,6 +62,7 @@ export class ProfilingPlugin
start: depsStart,
setup: deps,
config,
+ stackVersion,
telemetryUsageCounter,
},
services: {
diff --git a/x-pack/plugins/profiling/server/routes/index.ts b/x-pack/plugins/profiling/server/routes/index.ts
index a552670dac79d..d4b75e3cc1fa5 100644
--- a/x-pack/plugins/profiling/server/routes/index.ts
+++ b/x-pack/plugins/profiling/server/routes/index.ts
@@ -35,6 +35,7 @@ export interface RouteRegisterParameters {
start: ProfilingPluginStartDeps;
setup: ProfilingPluginSetupDeps;
config: ProfilingConfig;
+ stackVersion: string;
telemetryUsageCounter?: TelemetryUsageCounter;
};
services: {
diff --git a/x-pack/plugins/profiling/server/routes/setup.ts b/x-pack/plugins/profiling/server/routes/setup.ts
index c2fad18ad2b5a..289a360038fad 100644
--- a/x-pack/plugins/profiling/server/routes/setup.ts
+++ b/x-pack/plugins/profiling/server/routes/setup.ts
@@ -42,7 +42,7 @@ export function registerSetupRoute({
dependencies,
}: RouteRegisterParameters) {
const paths = getRoutePaths();
- // Check if Elasticsearch and Fleet are setup for Universal Profiling
+ // Check if Elasticsearch and Fleet are set up for Universal Profiling
router.get(
{
path: paths.HasSetupESResources,
@@ -249,7 +249,7 @@ export function registerSetupRoute({
}
}
);
- // Show users the instructions on how to setup Universal Profiling agents
+ // Show users the instructions on how to set up Universal Profiling agents
router.get(
{
path: paths.SetupDataCollectionInstructions,
@@ -259,10 +259,12 @@ export function registerSetupRoute({
async (context, request, response) => {
try {
const apmServerHost = dependencies.setup.cloud?.apm?.url;
+ const stackVersion = dependencies.stackVersion;
const setupInstructions = await getSetupInstructions({
packagePolicyClient: dependencies.start.fleet.packagePolicyService,
soClient: (await context.core).savedObjects.client,
apmServerHost,
+ stackVersion,
});
return response.ok({ body: setupInstructions });
diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json
index ede49d7ada790..69b5cdb5dd9e9 100644
--- a/x-pack/plugins/translations/translations/fr-FR.json
+++ b/x-pack/plugins/translations/translations/fr-FR.json
@@ -28301,24 +28301,17 @@
"xpack.profiling.tabs.binaryGrantPermissionStep": "Accorder des autorisations d'exécution :",
"xpack.profiling.tabs.binaryRunHostAgentStep": "Exécuter l'agent hôte Universal Profiling (requiert des privilèges racine) :",
"xpack.profiling.tabs.binaryTitle": "Binaire",
- "xpack.profiling.tabs.debDownloadPackageStep": "Ouvrir l'URL ci-dessous et télécharger le pack DEB correct pour votre architecture CPU :",
"xpack.profiling.tabs.debEditConfigStep": "Modifier la configuration (requiert des privilèges racine) :",
"xpack.profiling.tabs.debInstallPackageStep": "Installer le pack DEB (requiert des privilèges racine) :",
"xpack.profiling.tabs.debStartSystemdServiceStep": "Démarrer le service systemd Universal Profiling (requiert des privilèges racine) :",
"xpack.profiling.tabs.debTitle": "Pack DEB",
"xpack.profiling.tabs.dockerRunContainerStep": "Exécuter le conteneur Universal Profiling :",
"xpack.profiling.tabs.dockerTitle": "Docker",
- "xpack.profiling.tabs.elasticAgentIntegrarion.step1": "Copier des informations d’identification",
- "xpack.profiling.tabs.elasticAgentIntegrarion.step1.hint": "Vous aurez besoin de ces informations d’identification pour configurer Universal Profiling. Veuillez les conserver en lieu sûr, car elles seront nécessaires pour l’étape suivante.",
- "xpack.profiling.tabs.elasticAgentIntegrarion.step2": "Fleet",
- "xpack.profiling.tabs.elasticAgentIntegrarion.step2.button": "Gérer un agent Universal Profiling dans Fleet",
- "xpack.profiling.tabs.elasticAgentIntegrarion.title": "Intégration d'Elastic Agent",
"xpack.profiling.tabs.kubernetesInstallStep": "Installer l'agent hôte via Helm :",
"xpack.profiling.tabs.kubernetesRepositoryStep": "Configurer le référentiel Helm de l'agent hôte Universal Profiling :",
"xpack.profiling.tabs.kubernetesTitle": "Kubernetes",
"xpack.profiling.tabs.kubernetesValidationStep": "Confirmer que les pods de l'agent hôte sont en cours d'exécution :",
"xpack.profiling.tabs.postValidationStep": "Utiliser la sortie d'installation Helm pour obtenir les logs de l'agent hôte et repérer les erreurs potentielles",
- "xpack.profiling.tabs.rpmDownloadPackageStep": "Ouvrir l'URL ci-dessous et télécharger le pack RPM correct pour votre architecture CPU :",
"xpack.profiling.tabs.rpmEditConfigStep": "Modifier la configuration (requiert des privilèges racine) :",
"xpack.profiling.tabs.rpmInstallPackageStep": "Installer le pack RPM (requiert des privilèges racine) :",
"xpack.profiling.tabs.rpmStartSystemdServiceStep": "Démarrer le service systemd Universal Profiling (requiert des privilèges racine) :",
diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json
index cd453e55a3192..56e128816276b 100644
--- a/x-pack/plugins/translations/translations/ja-JP.json
+++ b/x-pack/plugins/translations/translations/ja-JP.json
@@ -28301,24 +28301,17 @@
"xpack.profiling.tabs.binaryGrantPermissionStep": "実行可能権限を付与:",
"xpack.profiling.tabs.binaryRunHostAgentStep": "ユニバーサルプロファイリングホストエージェントを実行(ルート権限が必要):",
"xpack.profiling.tabs.binaryTitle": "バイナリー",
- "xpack.profiling.tabs.debDownloadPackageStep": "以下のURLを開き、CPUアーキテクチャにあった適切なDEBパッケージをダウンロード:",
"xpack.profiling.tabs.debEditConfigStep": "構成を編集(ルート権限が必要):",
"xpack.profiling.tabs.debInstallPackageStep": "DEBパッケージをインストール(ルート権限が必要):",
"xpack.profiling.tabs.debStartSystemdServiceStep": "ユニバーサルプロファイリングシステムサービスを開始(ルート権限が必要):",
"xpack.profiling.tabs.debTitle": "DEBパッケージ",
"xpack.profiling.tabs.dockerRunContainerStep": "ユニバーサルプロファイリングコンテナーを実行:",
"xpack.profiling.tabs.dockerTitle": "Docker",
- "xpack.profiling.tabs.elasticAgentIntegrarion.step1": "資格情報をコピー",
- "xpack.profiling.tabs.elasticAgentIntegrarion.step1.hint": "ユニバーサルプロファイリングを設定するには、以下の資格情報が必要です。次のステップで必要となるため、安全な場所に保存してください。",
- "xpack.profiling.tabs.elasticAgentIntegrarion.step2": "Fleet",
- "xpack.profiling.tabs.elasticAgentIntegrarion.step2.button": "Fleetでユニバーサルプロファイリングエージェントを管理",
- "xpack.profiling.tabs.elasticAgentIntegrarion.title": "Elasticエージェント統合",
"xpack.profiling.tabs.kubernetesInstallStep": "Helm経由でホストエージェントをインストール:",
"xpack.profiling.tabs.kubernetesRepositoryStep": "ユニバーサルプロファイリングホストエージェントHelmリポジトリを構成:",
"xpack.profiling.tabs.kubernetesTitle": "Kubernetes",
"xpack.profiling.tabs.kubernetesValidationStep": "ホストエージェントポッドが実行中であることを検証:",
"xpack.profiling.tabs.postValidationStep": "Helmインストール出力を使用して、ホストエージェントログを取得し、潜在的なエラーを特定",
- "xpack.profiling.tabs.rpmDownloadPackageStep": "以下のURLを開き、CPUアーキテクチャにあった適切なRPMパッケージをダウンロード:",
"xpack.profiling.tabs.rpmEditConfigStep": "構成を編集(ルート権限が必要):",
"xpack.profiling.tabs.rpmInstallPackageStep": "RPMパッケージをインストール(ルート権限が必要):",
"xpack.profiling.tabs.rpmStartSystemdServiceStep": "ユニバーサルプロファイリングシステムサービスを開始(ルート権限が必要):",
diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json
index 21259f1ca85aa..8caefd7824672 100644
--- a/x-pack/plugins/translations/translations/zh-CN.json
+++ b/x-pack/plugins/translations/translations/zh-CN.json
@@ -28299,24 +28299,17 @@
"xpack.profiling.tabs.binaryGrantPermissionStep": "授予可执行权限:",
"xpack.profiling.tabs.binaryRunHostAgentStep": "运行 Universal Profiling 主机代理(需要根权限):",
"xpack.profiling.tabs.binaryTitle": "二进制",
- "xpack.profiling.tabs.debDownloadPackageStep": "打开下面的 URL 并为您的 CPU 架构下载正确的 DEB 软件包:",
"xpack.profiling.tabs.debEditConfigStep": "编辑配置(需要根权限):",
"xpack.profiling.tabs.debInstallPackageStep": "安装 DEB 软件包(需要根权限):",
"xpack.profiling.tabs.debStartSystemdServiceStep": "启动 Universal Profiling systemd 服务(需要根权限):",
"xpack.profiling.tabs.debTitle": "DEB 软件包",
"xpack.profiling.tabs.dockerRunContainerStep": "运行 Universal Profiling 容器:",
"xpack.profiling.tabs.dockerTitle": "Docker",
- "xpack.profiling.tabs.elasticAgentIntegrarion.step1": "复制凭据",
- "xpack.profiling.tabs.elasticAgentIntegrarion.step1.hint": "您需要这些凭据才能设置 Universal Profiling。请将它们保存到安全位置,因为在后续步骤中将需要用到它们。",
- "xpack.profiling.tabs.elasticAgentIntegrarion.step2": "Fleet",
- "xpack.profiling.tabs.elasticAgentIntegrarion.step2.button": "在 Fleet 中管理 Universal Profiling 代理",
- "xpack.profiling.tabs.elasticAgentIntegrarion.title": "Elastic 代理集成",
"xpack.profiling.tabs.kubernetesInstallStep": "通过 Helm 安装主机代理:",
"xpack.profiling.tabs.kubernetesRepositoryStep": "配置 Universal Profiling 主机代理 Helm 存储库:",
"xpack.profiling.tabs.kubernetesTitle": "Kubernetes",
"xpack.profiling.tabs.kubernetesValidationStep": "验证主机代理 Pod 是否正在运行:",
"xpack.profiling.tabs.postValidationStep": "使用 Helm 安装输出以获取主机代理日志并发现潜在错误",
- "xpack.profiling.tabs.rpmDownloadPackageStep": "打开下面的 URL 并为您的 CPU 架构下载正确的 RPM 软件包:",
"xpack.profiling.tabs.rpmEditConfigStep": "编辑配置(需要根权限):",
"xpack.profiling.tabs.rpmInstallPackageStep": "安装 RPM 软件包(需要根权限):",
"xpack.profiling.tabs.rpmStartSystemdServiceStep": "启动 Universal Profiling systemd 服务(需要根权限):",
From 819d3042100d3b50429bdb32a0693539966078ef Mon Sep 17 00:00:00 2001
From: Alex Szabo
Date: Tue, 15 Aug 2023 16:58:51 +0200
Subject: [PATCH 3/7] [Ops] Change dev-cli's config merging logic (#163928)
## Summary
Change config merging behaviour, so that arrays are not
merged/concatenated but replaced.
Closes: #162842
Related to: https://github.com/elastic/kibana/pull/161884
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
---
src/cli/serve/serve.js | 20 +++++++--
src/cli/serve/serve.test.js | 81 +++++++++++++++++++++++++++++++++++++
2 files changed, 97 insertions(+), 4 deletions(-)
create mode 100644 src/cli/serve/serve.test.js
diff --git a/src/cli/serve/serve.js b/src/cli/serve/serve.js
index 18e80f9324cb7..5027d0484fd16 100644
--- a/src/cli/serve/serve.js
+++ b/src/cli/serve/serve.js
@@ -55,11 +55,11 @@ function pathCollector() {
const configPathCollector = pathCollector();
const pluginPathCollector = pathCollector();
-function applyConfigOverrides(rawConfig, opts, extraCliOptions) {
+export function applyConfigOverrides(rawConfig, opts, extraCliOptions) {
const set = _.partial(lodashSet, rawConfig);
const get = _.partial(_.get, rawConfig);
const has = _.partial(_.has, rawConfig);
- const merge = _.partial(_.merge, rawConfig);
+
if (opts.oss) {
delete rawConfig.xpack;
}
@@ -135,8 +135,8 @@ function applyConfigOverrides(rawConfig, opts, extraCliOptions) {
set('plugins.paths', _.compact([].concat(get('plugins.paths'), opts.pluginPath)));
- merge(extraCliOptions);
- merge(readKeystore());
+ _.mergeWith(rawConfig, extraCliOptions, mergeAndReplaceArrays);
+ _.merge(rawConfig, readKeystore());
return rawConfig;
}
@@ -257,3 +257,15 @@ export default function (program) {
});
});
}
+
+function mergeAndReplaceArrays(objValue, srcValue) {
+ if (typeof srcValue === 'undefined') {
+ return objValue;
+ } else if (Array.isArray(srcValue)) {
+ // do not merge arrays, use new value instead
+ return srcValue;
+ } else {
+ // default to default merging
+ return undefined;
+ }
+}
diff --git a/src/cli/serve/serve.test.js b/src/cli/serve/serve.test.js
new file mode 100644
index 0000000000000..675180fa42421
--- /dev/null
+++ b/src/cli/serve/serve.test.js
@@ -0,0 +1,81 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+import { applyConfigOverrides } from './serve';
+
+describe('applyConfigOverrides', () => {
+ it('merges empty objects to an empty config', () => {
+ const output = applyConfigOverrides({}, {}, {});
+ const defaultEmptyConfig = {
+ plugins: {
+ paths: [],
+ },
+ };
+
+ expect(output).toEqual(defaultEmptyConfig);
+ });
+
+ it('merges objects', () => {
+ const output = applyConfigOverrides(
+ {
+ tomato: {
+ size: 40,
+ color: 'red',
+ },
+ },
+ {},
+ {
+ tomato: {
+ weight: 100,
+ },
+ }
+ );
+
+ expect(output).toEqual({
+ tomato: {
+ weight: 100,
+ color: 'red',
+ size: 40,
+ },
+ plugins: {
+ paths: [],
+ },
+ });
+ });
+
+ it('merges objects, but not arrays', () => {
+ const output = applyConfigOverrides(
+ {
+ tomato: {
+ color: 'red',
+ arr: [1, 2, 3],
+ },
+ },
+ {},
+ {
+ xyz: 40,
+ tomato: {
+ weight: 100,
+ arr: [4, 5],
+ },
+ }
+ );
+
+ expect(output).toEqual({
+ xyz: 40,
+ tomato: {
+ weight: 100,
+ color: 'red',
+ arr: [4, 5],
+ },
+ plugins: {
+ paths: [],
+ },
+ });
+ });
+});
From eb3002eb65ff34c6ec5a48b790803393cb1e3702 Mon Sep 17 00:00:00 2001
From: Maxim Kholod
Date: Tue, 15 Aug 2023 17:59:19 +0300
Subject: [PATCH 4/7] [Cloud Security] Findings Onboarding "not-installed" FTR
tests (#163722)
## Summary
This PR adds FTR tests for "not-installed" states of Findings page
Contributes to:
- https://github.com/elastic/kibana/issues/155657
## How to test
run in separate terminals
```
yarn test:ftr:server --config x-pack/test/cloud_security_posture_functional/config.ts
```
and
```
yarn test:ftr:runner --include-tag=cloud_security_posture_findings_onboarding --config x-pack/test/cloud_security_posture_functional/config.ts
```
---
.../public/components/no_findings_states.tsx | 20 ++++++-
.../components/no_vulnerabilities_states.tsx | 12 +++-
.../public/components/test_subjects.ts | 3 +
.../page_objects/findings_page.ts | 32 ++++++++++
.../pages/compliance_dashboard.ts | 3 +-
.../pages/findings.ts | 3 +-
.../pages/findings_onboarding.ts | 59 +++++++++++++++++++
.../pages/index.ts | 1 +
8 files changed, 126 insertions(+), 7 deletions(-)
create mode 100644 x-pack/test/cloud_security_posture_functional/pages/findings_onboarding.ts
diff --git a/x-pack/plugins/cloud_security_posture/public/components/no_findings_states.tsx b/x-pack/plugins/cloud_security_posture/public/components/no_findings_states.tsx
index a3227fee83dc5..292831821173e 100644
--- a/x-pack/plugins/cloud_security_posture/public/components/no_findings_states.tsx
+++ b/x-pack/plugins/cloud_security_posture/public/components/no_findings_states.tsx
@@ -24,7 +24,11 @@ import { CSPM_POLICY_TEMPLATE, KSPM_POLICY_TEMPLATE } from '../../common/constan
import { FullSizeCenteredPage } from './full_size_centered_page';
import { useCspBenchmarkIntegrations } from '../pages/benchmarks/use_csp_benchmark_integrations';
import { useCISIntegrationPoliciesLink } from '../common/navigation/use_navigate_to_cis_integration_policies';
-import { NO_FINDINGS_STATUS_TEST_SUBJ } from './test_subjects';
+import {
+ CSPM_NOT_INSTALLED_ACTION_SUBJ,
+ KSPM_NOT_INSTALLED_ACTION_SUBJ,
+ NO_FINDINGS_STATUS_TEST_SUBJ,
+} from './test_subjects';
import { CloudPosturePage, PACKAGE_NOT_INSTALLED_TEST_SUBJECT } from './cloud_posture_page';
import { useCspSetupStatusApi } from '../common/api/use_setup_status_api';
import type { IndexDetails, PostureTypes } from '../../common/types';
@@ -220,7 +224,12 @@ const ConfigurationFindingsInstalledEmptyPrompt = ({
actions={
-
+
-
+
-
+
({
+ getElement() {
+ return testSubjects.find(notInstalledSubject);
+ },
+
+ async navigateToAction(actionTestSubject: string) {
+ await testSubjects.click(actionTestSubject);
+ },
+ });
+
const createTableObject = (tableTestSubject: string) => ({
getElement() {
return testSubjects.find(tableTestSubject);
@@ -195,6 +205,22 @@ export function FindingsPageProvider({ getService, getPageObjects }: FtrProvider
);
};
+ const navigateToVulnerabilities = async () => {
+ await PageObjects.common.navigateToUrl(
+ 'securitySolution', // Defined in Security Solution plugin
+ 'cloud_security_posture/findings/vulnerabilities',
+ { shouldUseHashForSubUrl: false }
+ );
+ };
+
+ const navigateToMisconfigurations = async () => {
+ await PageObjects.common.navigateToUrl(
+ 'securitySolution', // Defined in Security Solution plugin
+ 'cloud_security_posture/findings/configurations',
+ { shouldUseHashForSubUrl: false }
+ );
+ };
+
const latestFindingsTable = createTableObject('latest_findings_table');
const resourceFindingsTable = createTableObject('resource_findings_table');
const findingsByResourceTable = {
@@ -210,12 +236,18 @@ export function FindingsPageProvider({ getService, getPageObjects }: FtrProvider
await link.click();
},
};
+ const notInstalledVulnerabilities = createNotInstalledObject('cnvm-integration-not-installed');
+ const notInstalledCSP = createNotInstalledObject('cloud_posture_page_package_not_installed');
return {
navigateToLatestFindingsPage,
+ navigateToVulnerabilities,
+ navigateToMisconfigurations,
latestFindingsTable,
resourceFindingsTable,
findingsByResourceTable,
+ notInstalledVulnerabilities,
+ notInstalledCSP,
index,
waitForPluginInitialized,
distributionBar,
diff --git a/x-pack/test/cloud_security_posture_functional/pages/compliance_dashboard.ts b/x-pack/test/cloud_security_posture_functional/pages/compliance_dashboard.ts
index cb4635899f5c3..2167726c4a09d 100644
--- a/x-pack/test/cloud_security_posture_functional/pages/compliance_dashboard.ts
+++ b/x-pack/test/cloud_security_posture_functional/pages/compliance_dashboard.ts
@@ -32,7 +32,8 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
},
];
- describe('Cloud Posture Dashboard Page', () => {
+ describe('Cloud Posture Dashboard Page', function () {
+ this.tags(['cloud_security_posture_compliance_dashboard']);
let cspDashboard: typeof pageObjects.cloudPostureDashboard;
let dashboard: typeof pageObjects.cloudPostureDashboard.dashboard;
diff --git a/x-pack/test/cloud_security_posture_functional/pages/findings.ts b/x-pack/test/cloud_security_posture_functional/pages/findings.ts
index 99c69ba29a694..5f85b38d39dd6 100644
--- a/x-pack/test/cloud_security_posture_functional/pages/findings.ts
+++ b/x-pack/test/cloud_security_posture_functional/pages/findings.ts
@@ -95,7 +95,8 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
const benchMarkName = data[0].rule.benchmark.name;
- describe('Findings Page', () => {
+ describe('Findings Page', function () {
+ this.tags(['cloud_security_posture_findings']);
let findings: typeof pageObjects.findings;
let latestFindingsTable: typeof findings.latestFindingsTable;
let findingsByResourceTable: typeof findings.findingsByResourceTable;
diff --git a/x-pack/test/cloud_security_posture_functional/pages/findings_onboarding.ts b/x-pack/test/cloud_security_posture_functional/pages/findings_onboarding.ts
new file mode 100644
index 0000000000000..474ed8d47c2a5
--- /dev/null
+++ b/x-pack/test/cloud_security_posture_functional/pages/findings_onboarding.ts
@@ -0,0 +1,59 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0; you may not use this file except in compliance with the Elastic License
+ * 2.0.
+ */
+
+import expect from '@kbn/expect';
+import { FtrProviderContext } from '../ftr_provider_context';
+
+// eslint-disable-next-line import/no-default-export
+export default ({ getPageObjects }: FtrProviderContext) => {
+ const PageObjects = getPageObjects(['common', 'findings', 'header']);
+
+ describe('Findings Page onboarding', function () {
+ this.tags(['cloud_security_posture_findings_onboarding']);
+ let findings: typeof PageObjects.findings;
+ let notInstalledVulnerabilities: typeof findings.notInstalledVulnerabilities;
+ let notInstalledCSP: typeof findings.notInstalledCSP;
+
+ beforeEach(async () => {
+ findings = PageObjects.findings;
+ notInstalledVulnerabilities = findings.notInstalledVulnerabilities;
+ notInstalledCSP = findings.notInstalledCSP;
+
+ await findings.waitForPluginInitialized();
+ });
+
+ it('clicking on the `No integrations installed` prompt action button - `install CNVM`: navigates to the CNVM integration installation page', async () => {
+ await findings.navigateToVulnerabilities();
+ await PageObjects.header.waitUntilLoadingHasFinished();
+ const element = await notInstalledVulnerabilities.getElement();
+ expect(element).to.not.be(null);
+
+ await notInstalledVulnerabilities.navigateToAction('cnvm-not-installed-action');
+ await PageObjects.common.waitUntilUrlIncludes('add-integration/vuln_mgmt');
+ });
+
+ it('clicking on the `No integrations installed` prompt action button - `install cloud posture intergation`: navigates to the CSPM integration installation page', async () => {
+ await findings.navigateToMisconfigurations();
+ await PageObjects.header.waitUntilLoadingHasFinished();
+ const element = await notInstalledCSP.getElement();
+ expect(element).to.not.be(null);
+
+ await notInstalledCSP.navigateToAction('cspm-not-installed-action');
+ await PageObjects.common.waitUntilUrlIncludes('add-integration/cspm');
+ });
+
+ it('clicking on the `No integrations installed` prompt action button - `install kubernetes posture intergation`: navigates to the KSPM integration installation page', async () => {
+ await findings.navigateToMisconfigurations();
+ await PageObjects.header.waitUntilLoadingHasFinished();
+ const element = await notInstalledCSP.getElement();
+ expect(element).to.not.be(null);
+
+ await notInstalledCSP.navigateToAction('kspm-not-installed-action');
+ await PageObjects.common.waitUntilUrlIncludes('add-integration/kspm');
+ });
+ });
+};
diff --git a/x-pack/test/cloud_security_posture_functional/pages/index.ts b/x-pack/test/cloud_security_posture_functional/pages/index.ts
index 7566afda0501a..1d30a3b27fda9 100644
--- a/x-pack/test/cloud_security_posture_functional/pages/index.ts
+++ b/x-pack/test/cloud_security_posture_functional/pages/index.ts
@@ -10,6 +10,7 @@ import { FtrProviderContext } from '../ftr_provider_context';
// eslint-disable-next-line import/no-default-export
export default function ({ loadTestFile }: FtrProviderContext) {
describe('Cloud Security Posture', function () {
+ loadTestFile(require.resolve('./findings_onboarding'));
loadTestFile(require.resolve('./findings'));
loadTestFile(require.resolve('./compliance_dashboard'));
});
From 065166215974078ca0e0e8bd3e8c1579b63e2bdb Mon Sep 17 00:00:00 2001
From: Karl Godard
Date: Tue, 15 Aug 2023 08:00:22 -0700
Subject: [PATCH 5/7] [Cloud Security] Aws credentials cleanup (#163528)
## Summary
The various unused credential methods supported by both the KSPM->EKS
and CSPM->AWS methods are not cleared out when a package is saved. As
there are currently two components on the frontend which allow the user
to specify their aws credential method, I've added hooks for both the
'packagePolicyCreate' and 'packagePolicyUpdate' methods in fleet to the
CSP serverside plugin. Both these hooks will pass the policy to a
cleanCredentials function which checks the 'aws.credentials.type' var to
determine which fields should be cleared out.
### Checklist
Delete any items that are not applicable to this PR.
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
---
.../common/constants.ts | 11 +-
.../cloud_security_posture/common/types.ts | 11 ++
.../common/utils/helpers.test.ts | 128 +++++++++++++++++-
.../common/utils/helpers.ts | 48 ++++++-
.../aws_credentials_form.tsx | 2 +-
.../get_aws_credentials_form_options.tsx | 8 +-
.../aws_credentials_form/hooks.ts | 2 +-
.../cloud_security_posture/server/plugin.ts | 30 ++++
8 files changed, 228 insertions(+), 12 deletions(-)
diff --git a/x-pack/plugins/cloud_security_posture/common/constants.ts b/x-pack/plugins/cloud_security_posture/common/constants.ts
index 2d8b8157ee758..7b9db8cfe5dbe 100644
--- a/x-pack/plugins/cloud_security_posture/common/constants.ts
+++ b/x-pack/plugins/cloud_security_posture/common/constants.ts
@@ -5,7 +5,7 @@
* 2.0.
*/
-import { PostureTypes, VulnSeverity } from './types';
+import { PostureTypes, VulnSeverity, AwsCredentialsTypeFieldMap } from './types';
export const STATUS_ROUTE_PATH = '/internal/cloud_security_posture/status';
export const STATUS_API_CURRENT_VERSION = '1';
@@ -125,5 +125,14 @@ export const VULNERABILITIES_SEVERITY: Record = {
};
export const VULNERABILITIES_ENUMERATION = 'CVE';
+
+export const AWS_CREDENTIALS_TYPE_TO_FIELDS_MAP: AwsCredentialsTypeFieldMap = {
+ assume_role: ['role_arn'],
+ direct_access_keys: ['access_key_id', 'secret_access_key'],
+ temporary_keys: ['access_key_id', 'secret_access_key', 'session_token'],
+ shared_credentials: ['shared_credential_file', 'credential_profile_name'],
+ cloud_formation: [],
+};
+
export const SETUP_ACCESS_CLOUD_SHELL = 'google_cloud_shell';
export const SETUP_ACCESS_MANUAL = 'manual';
diff --git a/x-pack/plugins/cloud_security_posture/common/types.ts b/x-pack/plugins/cloud_security_posture/common/types.ts
index f83fc5ae0fd73..956493de4c573 100644
--- a/x-pack/plugins/cloud_security_posture/common/types.ts
+++ b/x-pack/plugins/cloud_security_posture/common/types.ts
@@ -13,6 +13,17 @@ import { CspRuleTemplate } from './schemas';
import { findCspRuleTemplateRequest } from './schemas/csp_rule_template_api/get_csp_rule_template';
import { getComplianceDashboardSchema } from './schemas/stats';
+export type AwsCredentialsType =
+ | 'assume_role'
+ | 'direct_access_keys'
+ | 'temporary_keys'
+ | 'shared_credentials'
+ | 'cloud_formation';
+
+export type AwsCredentialsTypeFieldMap = {
+ [key in AwsCredentialsType]: string[];
+};
+
export type Evaluation = 'passed' | 'failed' | 'NA';
export type PostureTypes = 'cspm' | 'kspm' | 'vuln_mgmt' | 'all';
diff --git a/x-pack/plugins/cloud_security_posture/common/utils/helpers.test.ts b/x-pack/plugins/cloud_security_posture/common/utils/helpers.test.ts
index 24298518aef05..479cc2f62c36a 100644
--- a/x-pack/plugins/cloud_security_posture/common/utils/helpers.test.ts
+++ b/x-pack/plugins/cloud_security_posture/common/utils/helpers.test.ts
@@ -6,7 +6,11 @@
*/
import { createPackagePolicyMock } from '@kbn/fleet-plugin/common/mocks';
-import { getBenchmarkFromPackagePolicy, getBenchmarkTypeFilter } from './helpers';
+import {
+ getBenchmarkFromPackagePolicy,
+ getBenchmarkTypeFilter,
+ cleanupCredentials,
+} from './helpers';
describe('test helper methods', () => {
it('get default integration type from inputs with multiple enabled types', () => {
@@ -60,4 +64,126 @@ describe('test helper methods', () => {
const typeFilter = getBenchmarkTypeFilter('cis_eks');
expect(typeFilter).toMatch('csp-rule-template.attributes.metadata.benchmark.id: "cis_eks"');
});
+
+ describe('cleanupCredentials', () => {
+ it('cleans unused aws credential methods, except role_arn when using assume_role', () => {
+ const mockPackagePolicy = createPackagePolicyMock();
+ mockPackagePolicy.inputs = [
+ {
+ type: 'cloudbeat/cis_eks',
+ enabled: true,
+ streams: [
+ {
+ id: 'findings',
+ enabled: true,
+ data_stream: {
+ dataset: 'cloud_security_posture.findings',
+ type: 'logs',
+ },
+ vars: {
+ 'aws.credentials.type': { value: 'assume_role' },
+ access_key_id: { value: 'unused', type: 'text' },
+ credential_profile_name: { value: 'unused', type: 'text' },
+ role_arn: { value: 'inuse' },
+ secret_access_key: { value: 'unused', type: 'text' },
+ session_token: { value: 'unused', type: 'text' },
+ shared_credential_file: { value: 'unused', type: 'text' },
+ },
+ },
+ ],
+ },
+ ];
+
+ const cleanedPackage = cleanupCredentials(mockPackagePolicy);
+ expect(cleanedPackage.inputs[0].streams[0].vars).toEqual({
+ 'aws.credentials.type': { value: 'assume_role' },
+ access_key_id: { value: undefined, type: 'text' },
+ credential_profile_name: { value: undefined, type: 'text' },
+ role_arn: { value: 'inuse' },
+ secret_access_key: { value: undefined, type: 'text' },
+ session_token: { value: undefined, type: 'text' },
+ shared_credential_file: { value: undefined, type: 'text' },
+ });
+ });
+
+ it('cleans unused aws credential methods, when using cloud formation', () => {
+ const mockPackagePolicy = createPackagePolicyMock();
+ mockPackagePolicy.inputs = [
+ {
+ type: 'cloudbeat/cis_eks',
+ enabled: true,
+ streams: [
+ {
+ id: 'findings',
+ enabled: true,
+ data_stream: {
+ dataset: 'cloud_security_posture.findings',
+ type: 'logs',
+ },
+ vars: {
+ 'aws.credentials.type': { value: 'cloud_formation' },
+ access_key_id: { value: 'unused', type: 'text' },
+ credential_profile_name: { value: 'unused', type: 'text' },
+ role_arn: { value: 'unused' },
+ secret_access_key: { value: 'unused', type: 'text' },
+ session_token: { value: 'unused', type: 'text' },
+ shared_credential_file: { value: 'unused', type: 'text' },
+ },
+ },
+ ],
+ },
+ ];
+
+ const cleanedPackage = cleanupCredentials(mockPackagePolicy);
+ expect(cleanedPackage.inputs[0].streams[0].vars).toEqual({
+ 'aws.credentials.type': { value: 'cloud_formation' },
+ access_key_id: { value: undefined, type: 'text' },
+ credential_profile_name: { value: undefined, type: 'text' },
+ role_arn: { value: undefined },
+ secret_access_key: { value: undefined, type: 'text' },
+ session_token: { value: undefined, type: 'text' },
+ shared_credential_file: { value: undefined, type: 'text' },
+ });
+ });
+
+ it('cleans unused aws credential methods, when using direct_access_keys method ', () => {
+ const mockPackagePolicy = createPackagePolicyMock();
+ mockPackagePolicy.inputs = [
+ {
+ type: 'cloudbeat/cis_eks',
+ enabled: true,
+ streams: [
+ {
+ id: 'findings',
+ enabled: true,
+ data_stream: {
+ dataset: 'cloud_security_posture.findings',
+ type: 'logs',
+ },
+ vars: {
+ 'aws.credentials.type': { value: 'direct_access_keys' },
+ access_key_id: { value: 'used', type: 'text' },
+ credential_profile_name: { value: 'unused', type: 'text' },
+ role_arn: { value: 'unused' },
+ secret_access_key: { value: 'used', type: 'text' },
+ session_token: { value: 'unused', type: 'text' },
+ shared_credential_file: { value: 'unused', type: 'text' },
+ },
+ },
+ ],
+ },
+ ];
+
+ const cleanedPackage = cleanupCredentials(mockPackagePolicy);
+ expect(cleanedPackage.inputs[0].streams[0].vars).toEqual({
+ 'aws.credentials.type': { value: 'direct_access_keys' },
+ access_key_id: { value: 'used', type: 'text' },
+ credential_profile_name: { value: undefined, type: 'text' },
+ role_arn: { value: undefined },
+ secret_access_key: { value: 'used', type: 'text' },
+ session_token: { value: undefined, type: 'text' },
+ shared_credential_file: { value: undefined, type: 'text' },
+ });
+ });
+ });
});
diff --git a/x-pack/plugins/cloud_security_posture/common/utils/helpers.ts b/x-pack/plugins/cloud_security_posture/common/utils/helpers.ts
index 4483ed17da3e5..8a5fd5fa0112d 100644
--- a/x-pack/plugins/cloud_security_posture/common/utils/helpers.ts
+++ b/x-pack/plugins/cloud_security_posture/common/utils/helpers.ts
@@ -12,13 +12,15 @@ import {
PACKAGE_POLICY_SAVED_OBJECT_TYPE,
PackagePolicy,
PackagePolicyInput,
+ UpdatePackagePolicy,
} from '@kbn/fleet-plugin/common';
import {
CLOUD_SECURITY_POSTURE_PACKAGE_NAME,
CLOUDBEAT_VANILLA,
CSP_RULE_TEMPLATE_SAVED_OBJECT_TYPE,
+ AWS_CREDENTIALS_TYPE_TO_FIELDS_MAP,
} from '../constants';
-import type { BenchmarkId, Score, BaseCspSetupStatus } from '../types';
+import type { BenchmarkId, Score, BaseCspSetupStatus, AwsCredentialsType } from '../types';
/**
* @example
@@ -98,3 +100,47 @@ export const getStatusForIndexName = (indexName: string, status?: BaseCspSetupSt
return 'unknown';
};
+
+export const cleanupCredentials = (packagePolicy: NewPackagePolicy | UpdatePackagePolicy) => {
+ const enabledInput = packagePolicy.inputs.find((i) => i.enabled);
+ const credentialType: AwsCredentialsType | undefined =
+ enabledInput?.streams?.[0].vars?.['aws.credentials.type'].value;
+
+ if (credentialType) {
+ const credsToKeep = AWS_CREDENTIALS_TYPE_TO_FIELDS_MAP[credentialType];
+ const credFields = Object.values(AWS_CREDENTIALS_TYPE_TO_FIELDS_MAP).flat();
+
+ if (credsToKeep) {
+ // we need to return a copy of the policy with the unused
+ // credentials set to undefined
+ return {
+ ...packagePolicy,
+ inputs: packagePolicy.inputs.map((input) => {
+ if (input.enabled) {
+ return {
+ ...input,
+ streams: input.streams.map((stream) => {
+ const vars = stream.vars;
+ for (const field in vars) {
+ if (!credsToKeep.includes(field) && credFields.includes(field)) {
+ vars[field].value = undefined;
+ }
+ }
+
+ return {
+ ...stream,
+ vars,
+ };
+ }),
+ };
+ }
+
+ return input;
+ }),
+ };
+ }
+ }
+
+ // nothing to do, return unmutated policy
+ return packagePolicy;
+};
diff --git a/x-pack/plugins/cloud_security_posture/public/components/fleet_extensions/aws_credentials_form/aws_credentials_form.tsx b/x-pack/plugins/cloud_security_posture/public/components/fleet_extensions/aws_credentials_form/aws_credentials_form.tsx
index 4b50ccbd73c8a..1472a48faccfc 100644
--- a/x-pack/plugins/cloud_security_posture/public/components/fleet_extensions/aws_credentials_form/aws_credentials_form.tsx
+++ b/x-pack/plugins/cloud_security_posture/public/components/fleet_extensions/aws_credentials_form/aws_credentials_form.tsx
@@ -24,7 +24,6 @@ import { css } from '@emotion/react';
import { i18n } from '@kbn/i18n';
import {
getAwsCredentialsFormManualOptions,
- AwsCredentialsType,
AwsOptions,
DEFAULT_MANUAL_AWS_CREDENTIALS_TYPE,
} from './get_aws_credentials_form_options';
@@ -35,6 +34,7 @@ import {
NewPackagePolicyPostureInput,
} from '../utils';
import { SetupFormat, useAwsCredentialsForm } from './hooks';
+import { AwsCredentialsType } from '../../../../common/types';
interface AWSSetupInfoContentProps {
integrationLink: string;
diff --git a/x-pack/plugins/cloud_security_posture/public/components/fleet_extensions/aws_credentials_form/get_aws_credentials_form_options.tsx b/x-pack/plugins/cloud_security_posture/public/components/fleet_extensions/aws_credentials_form/get_aws_credentials_form_options.tsx
index b7c1e1d36b5cc..71882d4cc67cf 100644
--- a/x-pack/plugins/cloud_security_posture/public/components/fleet_extensions/aws_credentials_form/get_aws_credentials_form_options.tsx
+++ b/x-pack/plugins/cloud_security_posture/public/components/fleet_extensions/aws_credentials_form/get_aws_credentials_form_options.tsx
@@ -10,6 +10,7 @@ import { EuiText } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import { i18n } from '@kbn/i18n';
import { NewPackagePolicyInput } from '@kbn/fleet-plugin/common';
+import { AwsCredentialsType } from '../../../../common/types';
const AssumeRoleDescription = (
@@ -69,13 +70,6 @@ const AWS_FIELD_LABEL = {
}),
};
-export type AwsCredentialsType =
- | 'assume_role'
- | 'direct_access_keys'
- | 'temporary_keys'
- | 'shared_credentials'
- | 'cloud_formation';
-
export type AwsCredentialsFields = Record
;
export interface AwsOptionValue {
diff --git a/x-pack/plugins/cloud_security_posture/public/components/fleet_extensions/aws_credentials_form/hooks.ts b/x-pack/plugins/cloud_security_posture/public/components/fleet_extensions/aws_credentials_form/hooks.ts
index c689c99b52dfe..190ae47a61aec 100644
--- a/x-pack/plugins/cloud_security_posture/public/components/fleet_extensions/aws_credentials_form/hooks.ts
+++ b/x-pack/plugins/cloud_security_posture/public/components/fleet_extensions/aws_credentials_form/hooks.ts
@@ -14,12 +14,12 @@ import {
NewPackagePolicyPostureInput,
} from '../utils';
import {
- AwsCredentialsType,
DEFAULT_MANUAL_AWS_CREDENTIALS_TYPE,
getAwsCredentialsFormOptions,
getInputVarsFields,
} from './get_aws_credentials_form_options';
import { CLOUDBEAT_AWS } from '../../../../common/constants';
+import { AwsCredentialsType } from '../../../../common/types';
/**
* Update CloudFormation template and stack name in the Agent Policy
* based on the selected policy template
diff --git a/x-pack/plugins/cloud_security_posture/server/plugin.ts b/x-pack/plugins/cloud_security_posture/server/plugin.ts
index 65940b380c550..30ff887a354ca 100755
--- a/x-pack/plugins/cloud_security_posture/server/plugin.ts
+++ b/x-pack/plugins/cloud_security_posture/server/plugin.ts
@@ -18,6 +18,7 @@ import type {
PostDeletePackagePoliciesResponse,
PackagePolicy,
NewPackagePolicy,
+ UpdatePackagePolicy,
} from '@kbn/fleet-plugin/common';
import type {
TaskManagerSetupContract,
@@ -25,6 +26,7 @@ import type {
} from '@kbn/task-manager-plugin/server';
import { isCspPackage } from '../common/utils/helpers';
import { isSubscriptionAllowed } from '../common/utils/subscription';
+import { cleanupCredentials } from '../common/utils/helpers';
import type {
CspServerPluginSetup,
CspServerPluginStart,
@@ -124,6 +126,34 @@ export class CspPlugin
}
);
+ plugins.fleet.registerExternalCallback(
+ 'packagePolicyCreate',
+ async (
+ packagePolicy: NewPackagePolicy,
+ soClient: SavedObjectsClientContract
+ ): Promise => {
+ if (isCspPackage(packagePolicy.package?.name)) {
+ return cleanupCredentials(packagePolicy);
+ }
+
+ return packagePolicy;
+ }
+ );
+
+ plugins.fleet.registerExternalCallback(
+ 'packagePolicyUpdate',
+ async (
+ packagePolicy: UpdatePackagePolicy,
+ soClient: SavedObjectsClientContract
+ ): Promise => {
+ if (isCspPackage(packagePolicy.package?.name)) {
+ return cleanupCredentials(packagePolicy);
+ }
+
+ return packagePolicy;
+ }
+ );
+
plugins.fleet.registerExternalCallback(
'packagePolicyPostCreate',
async (
From 9da44e3571549e9eb5f00f3de4f89446e305e78b Mon Sep 17 00:00:00 2001
From: Tim Sullivan
Date: Tue, 15 Aug 2023 09:18:49 -0700
Subject: [PATCH 6/7] [Reporting/Docs] Tighten the language around CSV settings
(#163505)
## Summary
Docs request to tighten the language around csv.maxSizeBytes on this
[page](https://www.elastic.co/guide/en/kibana/8.8/reporting-settings-kb.html#reporting-csv-settings).
- [x] test the links
Closes: https://github.com/elastic/kibana/issues/159112
Replaces: https://github.com/elastic/kibana/pull/161189
---------
Co-authored-by: Amy Jonsson
Co-authored-by: amyjtechwriter <61687663+amyjtechwriter@users.noreply.github.com>
---
docs/settings/reporting-settings.asciidoc | 36 +++++++++++++++++------
1 file changed, 27 insertions(+), 9 deletions(-)
diff --git a/docs/settings/reporting-settings.asciidoc b/docs/settings/reporting-settings.asciidoc
index 77f1b01cc21b4..424a661820423 100644
--- a/docs/settings/reporting-settings.asciidoc
+++ b/docs/settings/reporting-settings.asciidoc
@@ -203,26 +203,40 @@ The `file:` protocol is always denied, even if no network policy is configured.
==== CSV settings
[[xpack-reporting-csv]] `xpack.reporting.csv.maxSizeBytes` {ess-icon}::
-The maximum {byte-units}[byte size] of a CSV file before being truncated. This setting exists to prevent large exports from causing performance and storage issues. Can be specified as number of bytes. Defaults to `10mb`.
+The maximum {byte-units}[byte size] of a CSV file before being truncated. This setting exists to prevent large
+exports from causing performance and storage issues. Can be specified as number of bytes. Defaults to `250mb`.
[NOTE]
============
-Setting `xpack.reporting.csv.maxSizeBytes` much larger than the default 10 MB limit has the potential to negatively affect the
-performance of {kib} and your {es} cluster. There is no enforced maximum for this setting, but a reasonable maximum value depends
-on multiple factors:
+We recommend using CSV reports to export moderate amounts of data only. The feature enables analysis of data in
+external tools, but it's not intended for bulk export or to backup {es} data. If you need to export more than
+250 MB of CSV, rather than increasing `xpack.reporting.csv.maxSizeBytes`, please use filters to create multiple
+smaller reports, or extract the data you need directly from {es}.
-* The `http.max_content_length` setting in {es}.
-* Network proxies, which are often configured by default to block large requests with a 413 error.
-* The amount of memory available to the {kib} server, which limits the size of CSV data that must be held temporarily.
+The following deployment configurations may lead to failed report jobs or incomplete reports:
-For information about {kib} memory limits, see <>.
+* Any shard needed for search is unavailable.
+* Data is stored on slow storage tiers.
+* Network latency between nodes is high.
+* {ccs-cap} is used.
+
+To export large amounts of data we recommend using {es} APIs directly. See {ref}/point-in-time-api.html[Point
+in time API], or {ref}/sql-rest-format.html#_csv[SQL with CSV response data format].
============
`xpack.reporting.csv.scroll.size`::
Number of documents retrieved from {es} for each scroll iteration during a CSV export. Defaults to `500`.
+[NOTE]
+============
+You may need to lower this setting if the default number of documents creates a strain on network resources.
+============
`xpack.reporting.csv.scroll.duration`::
Amount of {time-units}[time] allowed before {kib} cleans the scroll context during a CSV export. Defaults to `30s`.
+[NOTE]
+============
+If search latency in {es} is sufficiently high, such as if you are using {ccs}, you may need to increase the setting.
+============
`xpack.reporting.csv.checkForFormulas`::
Enables a check that warns you when there's a potential formula included in the output (=, -, +, and @ chars). See OWASP: https://www.owasp.org/index.php/CSV_Injection. Defaults to `true`.
@@ -231,7 +245,11 @@ Enables a check that warns you when there's a potential formula included in the
Escape formula values in cells with a `'`. See OWASP: https://www.owasp.org/index.php/CSV_Injection. Defaults to `true`.
`xpack.reporting.csv.enablePanelActionDownload`::
-deprecated:[7.9.0,This setting has no effect.] Enables CSV export from a saved search on a dashboard. This action is available in the dashboard panel menu for the saved search. *NOTE*: This setting exists for backwards compatibility, but is unused and hardcoded to `true`. CSV export from a saved search on a dashboard is enabled when Reporting is enabled.
+deprecated:[7.9.0,This setting has no effect.] Enables CSV export from a saved search on a dashboard. This action is available in the dashboard panel menu for the saved search.
+[NOTE]
+============
+This setting exists for backwards compatibility, and is hardcoded to `true`. CSV export from a saved search on a dashboard is enabled when Reporting is enabled.
+============
`xpack.reporting.csv.useByteOrderMarkEncoding`::
Adds a byte order mark (`\ufeff`) at the beginning of the CSV file. Defaults to `false`.
From d5a3ed1dee2ab263d0a7e6683c0a14a0e04103e2 Mon Sep 17 00:00:00 2001
From: Sander Philipse <94373878+sphilipse@users.noreply.github.com>
Date: Tue, 15 Aug 2023 18:31:22 +0200
Subject: [PATCH 7/7] [Serverless] Add deployment URL (#163925)
## Summary
This adds a link to the concrete project in Serverless ES3. We can't
link to performance directly because that has been descoped for now.
---
.../core-chrome-browser/src/project_navigation.ts | 2 +-
.../chrome/navigation/src/cloud_links.tsx | 14 +++++++++++++-
.../serverless_search/public/layout/nav.tsx | 7 +++++++
3 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/packages/core/chrome/core-chrome-browser/src/project_navigation.ts b/packages/core/chrome/core-chrome-browser/src/project_navigation.ts
index 38317cfc1e0f2..b2a0384e3a1a9 100644
--- a/packages/core/chrome/core-chrome-browser/src/project_navigation.ts
+++ b/packages/core/chrome/core-chrome-browser/src/project_navigation.ts
@@ -45,7 +45,7 @@ export type AppDeepLinkId =
| ObservabilityLink;
/** @public */
-export type CloudLinkId = 'userAndRoles' | 'performance' | 'billingAndSub';
+export type CloudLinkId = 'userAndRoles' | 'performance' | 'billingAndSub' | 'deployment';
export type GetIsActiveFn = (params: {
/** The current path name including the basePath + hash value but **without** any query params */
diff --git a/packages/shared-ux/chrome/navigation/src/cloud_links.tsx b/packages/shared-ux/chrome/navigation/src/cloud_links.tsx
index 4efd73b8e3a97..fd1909551888b 100644
--- a/packages/shared-ux/chrome/navigation/src/cloud_links.tsx
+++ b/packages/shared-ux/chrome/navigation/src/cloud_links.tsx
@@ -17,7 +17,7 @@ export type CloudLinks = {
};
export const getCloudLinks = (cloud: CloudStart): CloudLinks => {
- const { billingUrl, performanceUrl, usersAndRolesUrl } = cloud;
+ const { billingUrl, deploymentUrl, performanceUrl, usersAndRolesUrl } = cloud;
const links: CloudLinks = {};
@@ -54,5 +54,17 @@ export const getCloudLinks = (cloud: CloudStart): CloudLinks => {
};
}
+ if (deploymentUrl) {
+ links.deployment = {
+ title: i18n.translate(
+ 'sharedUXPackages.chrome.sideNavigation.cloudLinks.deploymentLinkText',
+ {
+ defaultMessage: 'Project',
+ }
+ ),
+ href: deploymentUrl,
+ };
+ }
+
return links;
};
diff --git a/x-pack/plugins/serverless_search/public/layout/nav.tsx b/x-pack/plugins/serverless_search/public/layout/nav.tsx
index fd460f8c95066..568b3e8ca5cdf 100644
--- a/x-pack/plugins/serverless_search/public/layout/nav.tsx
+++ b/x-pack/plugins/serverless_search/public/layout/nav.tsx
@@ -134,6 +134,13 @@ const navigationTree: NavigationTreeDefinition = {
defaultMessage: 'Management',
}),
},
+ {
+ id: 'cloudLinkDeployment',
+ cloudLink: 'deployment',
+ title: i18n.translate('xpack.serverlessSearch.nav.performance', {
+ defaultMessage: 'Performance',
+ }),
+ },
{
id: 'cloudLinkUserAndRoles',
cloudLink: 'userAndRoles',