diff --git a/x-pack/plugins/observability/public/components/shared/field_value_suggestions/index.test.tsx b/x-pack/plugins/observability/public/components/shared/field_value_suggestions/index.test.tsx
index 6671c43dd8c7b..556a8e7052347 100644
--- a/x-pack/plugins/observability/public/components/shared/field_value_suggestions/index.test.tsx
+++ b/x-pack/plugins/observability/public/components/shared/field_value_suggestions/index.test.tsx
@@ -95,7 +95,6 @@ describe('FieldValueSuggestions', () => {
selectedValue={[]}
filters={[]}
asCombobox={false}
- allowExclusions={true}
/>
);
@@ -120,7 +119,6 @@ describe('FieldValueSuggestions', () => {
excludedValue={['Pak']}
filters={[]}
asCombobox={false}
- allowExclusions={true}
/>
);
diff --git a/x-pack/plugins/observability/public/components/shared/field_value_suggestions/index.tsx b/x-pack/plugins/observability/public/components/shared/field_value_suggestions/index.tsx
index 65e1d0932e4ed..54114c7604644 100644
--- a/x-pack/plugins/observability/public/components/shared/field_value_suggestions/index.tsx
+++ b/x-pack/plugins/observability/public/components/shared/field_value_suggestions/index.tsx
@@ -28,10 +28,7 @@ export function FieldValueSuggestions({
singleSelection,
compressed,
asFilterButton,
- usePrependLabel,
allowAllValuesSelection,
- required,
- allowExclusions = true,
asCombobox = true,
onChange: onSelectionChange,
}: FieldValueSuggestionsProps) {
@@ -67,10 +64,7 @@ export function FieldValueSuggestions({
width={width}
compressed={compressed}
asFilterButton={asFilterButton}
- usePrependLabel={usePrependLabel}
- allowExclusions={allowExclusions}
allowAllValuesSelection={allowAllValuesSelection}
- required={required}
/>
);
}
diff --git a/x-pack/plugins/observability/public/components/shared/field_value_suggestions/types.ts b/x-pack/plugins/observability/public/components/shared/field_value_suggestions/types.ts
index 73b3d78ce8700..d857b39b074ac 100644
--- a/x-pack/plugins/observability/public/components/shared/field_value_suggestions/types.ts
+++ b/x-pack/plugins/observability/public/components/shared/field_value_suggestions/types.ts
@@ -23,10 +23,7 @@ interface CommonProps {
compressed?: boolean;
asFilterButton?: boolean;
showCount?: boolean;
- usePrependLabel?: boolean;
- allowExclusions?: boolean;
allowAllValuesSelection?: boolean;
- required?: boolean;
}
export type FieldValueSuggestionsProps = CommonProps & {
diff --git a/x-pack/plugins/observability/public/components/shared/filter_value_label/filter_value_label.tsx b/x-pack/plugins/observability/public/components/shared/filter_value_label/filter_value_label.tsx
index 9e7b96b02206f..01d727071770d 100644
--- a/x-pack/plugins/observability/public/components/shared/filter_value_label/filter_value_label.tsx
+++ b/x-pack/plugins/observability/public/components/shared/filter_value_label/filter_value_label.tsx
@@ -18,25 +18,21 @@ export function buildFilterLabel({
negate,
}: {
label: string;
- value: string | string[];
+ value: string;
negate: boolean;
field: string;
indexPattern: IndexPattern;
}) {
const indexField = indexPattern.getFieldByName(field)!;
- const filter =
- value instanceof Array && value.length > 1
- ? esFilters.buildPhrasesFilter(indexField, value, indexPattern)
- : esFilters.buildPhraseFilter(indexField, value as string, indexPattern);
+ const filter = esFilters.buildPhraseFilter(indexField, value, indexPattern);
- filter.meta.type = value instanceof Array && value.length > 1 ? 'phrases' : 'phrase';
-
- filter.meta.value = value as string;
+ filter.meta.value = value;
filter.meta.key = label;
filter.meta.alias = null;
filter.meta.negate = negate;
filter.meta.disabled = false;
+ filter.meta.type = 'phrase';
return filter;
}
@@ -44,10 +40,10 @@ export function buildFilterLabel({
interface Props {
field: string;
label: string;
- value: string | string[];
+ value: string;
negate: boolean;
- removeFilter: (field: string, value: string | string[], notVal: boolean) => void;
- invertFilter: (val: { field: string; value: string | string[]; negate: boolean }) => void;
+ removeFilter: (field: string, value: string, notVal: boolean) => void;
+ invertFilter: (val: { field: string; value: string; negate: boolean }) => void;
indexPattern: IndexPattern;
allowExclusion?: boolean;
}
diff --git a/x-pack/plugins/observability/public/components/shared/index.tsx b/x-pack/plugins/observability/public/components/shared/index.tsx
index afc053604fcdf..9d557a40b7987 100644
--- a/x-pack/plugins/observability/public/components/shared/index.tsx
+++ b/x-pack/plugins/observability/public/components/shared/index.tsx
@@ -6,7 +6,6 @@
*/
import React, { lazy, Suspense } from 'react';
-import { EuiLoadingSpinner } from '@elastic/eui';
import type { CoreVitalProps, HeaderMenuPortalProps } from './types';
import type { FieldValueSuggestionsProps } from './field_value_suggestions/types';
@@ -27,7 +26,7 @@ const HeaderMenuPortalLazy = lazy(() => import('./header_menu_portal'));
export function HeaderMenuPortal(props: HeaderMenuPortalProps) {
return (
-
}>
+
);
diff --git a/x-pack/plugins/observability/public/hooks/use_quick_time_ranges.tsx b/x-pack/plugins/observability/public/hooks/use_quick_time_ranges.tsx
index 198b4092b0ed6..82a0fc39b8519 100644
--- a/x-pack/plugins/observability/public/hooks/use_quick_time_ranges.tsx
+++ b/x-pack/plugins/observability/public/hooks/use_quick_time_ranges.tsx
@@ -7,7 +7,7 @@
import { useUiSetting } from '../../../../../src/plugins/kibana_react/public';
import { UI_SETTINGS } from '../../../../../src/plugins/data/common';
-import { TimePickerQuickRange } from '../components/shared/exploratory_view/components/series_date_picker';
+import { TimePickerQuickRange } from '../components/shared/exploratory_view/series_date_picker';
export function useQuickTimeRanges() {
const timePickerQuickRanges = useUiSetting
(
diff --git a/x-pack/plugins/observability/public/plugin.ts b/x-pack/plugins/observability/public/plugin.ts
index 334733e363495..71b83b9e05324 100644
--- a/x-pack/plugins/observability/public/plugin.ts
+++ b/x-pack/plugins/observability/public/plugin.ts
@@ -24,7 +24,6 @@ import type {
DataPublicPluginSetup,
DataPublicPluginStart,
} from '../../../../src/plugins/data/public';
-import type { DiscoverStart } from '../../../../src/plugins/discover/public';
import type {
HomePublicPluginSetup,
HomePublicPluginStart,
@@ -57,7 +56,6 @@ export interface ObservabilityPublicPluginsStart {
triggersActionsUi: TriggersAndActionsUIPublicPluginStart;
data: DataPublicPluginStart;
lens: LensPublicStart;
- discover: DiscoverStart;
}
export type ObservabilityPublicStart = ReturnType;
diff --git a/x-pack/plugins/observability/public/routes/index.tsx b/x-pack/plugins/observability/public/routes/index.tsx
index 09d22496c98ff..f97e3fb996441 100644
--- a/x-pack/plugins/observability/public/routes/index.tsx
+++ b/x-pack/plugins/observability/public/routes/index.tsx
@@ -7,7 +7,6 @@
import * as t from 'io-ts';
import React from 'react';
-import { Redirect } from 'react-router-dom';
import { alertStatusRt } from '../../common/typings';
import { ExploratoryViewPage } from '../components/shared/exploratory_view';
import { AlertsPage } from '../pages/alerts';
@@ -100,20 +99,7 @@ export const routes = {
}),
},
},
- '/exploratory-view/': {
- handler: () => {
- return ;
- },
- params: {
- query: t.partial({
- rangeFrom: t.string,
- rangeTo: t.string,
- refreshPaused: jsonRt.pipe(t.boolean),
- refreshInterval: jsonRt.pipe(t.number),
- }),
- },
- },
- '/exploratory-view/:mode': {
+ '/exploratory-view': {
handler: () => {
return ;
},
@@ -126,4 +112,18 @@ export const routes = {
}),
},
},
+ // enable this to test multi series architecture
+ // '/exploratory-view/multi': {
+ // handler: () => {
+ // return ;
+ // },
+ // params: {
+ // query: t.partial({
+ // rangeFrom: t.string,
+ // rangeTo: t.string,
+ // refreshPaused: jsonRt.pipe(t.boolean),
+ // refreshInterval: jsonRt.pipe(t.number),
+ // }),
+ // },
+ // },
};
diff --git a/x-pack/plugins/osquery/common/types.ts b/x-pack/plugins/osquery/common/types.ts
index d195198e54a73..7244066f798ba 100644
--- a/x-pack/plugins/osquery/common/types.ts
+++ b/x-pack/plugins/osquery/common/types.ts
@@ -9,8 +9,11 @@ import { PackagePolicy, PackagePolicyInput, PackagePolicyInputStream } from '../
export const savedQuerySavedObjectType = 'osquery-saved-query';
export const packSavedObjectType = 'osquery-pack';
-export const usageMetricSavedObjectType = 'osquery-usage-metric';
-export type SavedObjectType = 'osquery-saved-query' | 'osquery-pack' | 'osquery-usage-metric';
+export const usageMetricSavedObjectType = 'osquery-manager-usage-metric';
+export type SavedObjectType =
+ | 'osquery-saved-query'
+ | 'osquery-pack'
+ | 'osquery-manager-usage-metric';
/**
* This makes any optional property the same as Required would but also has the
diff --git a/x-pack/plugins/osquery/public/action_results/action_results_summary.tsx b/x-pack/plugins/osquery/public/action_results/action_results_summary.tsx
index 75277059bbf97..083d0193be2a2 100644
--- a/x-pack/plugins/osquery/public/action_results/action_results_summary.tsx
+++ b/x-pack/plugins/osquery/public/action_results/action_results_summary.tsx
@@ -15,6 +15,7 @@ import { AgentIdToName } from '../agents/agent_id_to_name';
import { useActionResults } from './use_action_results';
import { useAllResults } from '../results/use_all_results';
import { Direction } from '../../common/search_strategy';
+import { useActionResultsPrivileges } from './use_action_privileges';
interface ActionResultsSummaryProps {
actionId: string;
@@ -41,6 +42,7 @@ const ActionResultsSummaryComponent: React.FC = ({
expirationDate,
]);
const [isLive, setIsLive] = useState(true);
+ const { data: hasActionResultsPrivileges } = useActionResultsPrivileges();
const {
// @ts-expect-error update types
data: { aggregations, edges },
@@ -52,6 +54,7 @@ const ActionResultsSummaryComponent: React.FC = ({
direction: Direction.asc,
sortField: '@timestamp',
isLive,
+ skip: !hasActionResultsPrivileges,
});
if (expired) {
// @ts-expect-error update types
@@ -77,6 +80,7 @@ const ActionResultsSummaryComponent: React.FC = ({
},
],
isLive,
+ skip: !hasActionResultsPrivileges,
});
const renderAgentIdColumn = useCallback((agentId) => , []);
diff --git a/x-pack/plugins/osquery/public/action_results/use_action_privileges.tsx b/x-pack/plugins/osquery/public/action_results/use_action_privileges.tsx
new file mode 100644
index 0000000000000..2c80c874e89fa
--- /dev/null
+++ b/x-pack/plugins/osquery/public/action_results/use_action_privileges.tsx
@@ -0,0 +1,33 @@
+/*
+ * 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 { useQuery } from 'react-query';
+
+import { i18n } from '@kbn/i18n';
+import { useKibana } from '../common/lib/kibana';
+import { useErrorToast } from '../common/hooks/use_error_toast';
+
+export const useActionResultsPrivileges = () => {
+ const { http } = useKibana().services;
+ const setErrorToast = useErrorToast();
+
+ return useQuery(
+ ['actionResultsPrivileges'],
+ () => http.get('/internal/osquery/privileges_check'),
+ {
+ keepPreviousData: true,
+ select: (response) => response?.has_all_requested ?? false,
+ onSuccess: () => setErrorToast(),
+ onError: (error: Error) =>
+ setErrorToast(error, {
+ title: i18n.translate('xpack.osquery.action_results_privileges.fetchError', {
+ defaultMessage: 'Error while fetching action results privileges',
+ }),
+ }),
+ }
+ );
+};
diff --git a/x-pack/plugins/osquery/public/agent_policies/use_agent_policies.ts b/x-pack/plugins/osquery/public/agent_policies/use_agent_policies.ts
index c51f2d2f44a5c..74061915d3b86 100644
--- a/x-pack/plugins/osquery/public/agent_policies/use_agent_policies.ts
+++ b/x-pack/plugins/osquery/public/agent_policies/use_agent_policies.ts
@@ -9,11 +9,7 @@ import { useQuery } from 'react-query';
import { i18n } from '@kbn/i18n';
import { useKibana } from '../common/lib/kibana';
-import {
- agentPolicyRouteService,
- GetAgentPoliciesResponse,
- GetAgentPoliciesResponseItem,
-} from '../../../fleet/common';
+import { GetAgentPoliciesResponse, GetAgentPoliciesResponseItem } from '../../../fleet/common';
import { useErrorToast } from '../common/hooks/use_error_toast';
export const useAgentPolicies = () => {
@@ -22,12 +18,7 @@ export const useAgentPolicies = () => {
return useQuery(
['agentPolicies'],
- () =>
- http.get(agentPolicyRouteService.getListPath(), {
- query: {
- perPage: 100,
- },
- }),
+ () => http.get('/internal/osquery/fleet_wrapper/agent_policies/'),
{
initialData: { items: [], total: 0, page: 1, perPage: 100 },
keepPreviousData: true,
diff --git a/x-pack/plugins/osquery/public/agent_policies/use_agent_policy.ts b/x-pack/plugins/osquery/public/agent_policies/use_agent_policy.ts
index dcebf136b6773..302567ef25640 100644
--- a/x-pack/plugins/osquery/public/agent_policies/use_agent_policy.ts
+++ b/x-pack/plugins/osquery/public/agent_policies/use_agent_policy.ts
@@ -9,7 +9,6 @@ import { useQuery } from 'react-query';
import { i18n } from '@kbn/i18n';
import { useKibana } from '../common/lib/kibana';
-import { agentPolicyRouteService } from '../../../fleet/common';
import { useErrorToast } from '../common/hooks/use_error_toast';
interface UseAgentPolicy {
@@ -23,7 +22,7 @@ export const useAgentPolicy = ({ policyId, skip }: UseAgentPolicy) => {
return useQuery(
['agentPolicy', { policyId }],
- () => http.get(agentPolicyRouteService.getInfoPath(policyId)),
+ () => http.get(`/internal/osquery/fleet_wrapper/agent_policies/${policyId}`),
{
enabled: !skip,
keepPreviousData: true,
diff --git a/x-pack/plugins/osquery/public/agents/agents_table.tsx b/x-pack/plugins/osquery/public/agents/agents_table.tsx
index 53e2ce1d53420..8a40cb171070d 100644
--- a/x-pack/plugins/osquery/public/agents/agents_table.tsx
+++ b/x-pack/plugins/osquery/public/agents/agents_table.tsx
@@ -65,9 +65,13 @@ const AgentsTableComponent: React.FC = ({ agentSelection, onCh
osqueryPolicyData
);
const grouper = useMemo(() => new AgentGrouper(), []);
- const { agentsLoading, agents } = useAllAgents(osqueryPolicyData, debouncedSearchValue, {
- perPage,
- });
+ const { isLoading: agentsLoading, data: agents } = useAllAgents(
+ osqueryPolicyData,
+ debouncedSearchValue,
+ {
+ perPage,
+ }
+ );
// option related
const [options, setOptions] = useState([]);
@@ -108,8 +112,8 @@ const AgentsTableComponent: React.FC = ({ agentSelection, onCh
grouper.setTotalAgents(totalNumAgents);
grouper.updateGroup(AGENT_GROUP_KEY.Platform, groups.platforms);
grouper.updateGroup(AGENT_GROUP_KEY.Policy, groups.policies);
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- grouper.updateGroup(AGENT_GROUP_KEY.Agent, agents!);
+ // @ts-expect-error update types
+ grouper.updateGroup(AGENT_GROUP_KEY.Agent, agents);
const newOptions = grouper.generateOptions();
setOptions(newOptions);
}, [groups.platforms, groups.policies, totalNumAgents, groupsLoading, agents, grouper]);
diff --git a/x-pack/plugins/osquery/public/agents/use_agent_details.ts b/x-pack/plugins/osquery/public/agents/use_agent_details.ts
index 1a0663812dec3..b0c2fb2e1cbaf 100644
--- a/x-pack/plugins/osquery/public/agents/use_agent_details.ts
+++ b/x-pack/plugins/osquery/public/agents/use_agent_details.ts
@@ -8,7 +8,7 @@
import { i18n } from '@kbn/i18n';
import { useQuery } from 'react-query';
-import { GetOneAgentResponse, agentRouteService } from '../../../fleet/common';
+import { GetOneAgentResponse } from '../../../fleet/common';
import { useErrorToast } from '../common/hooks/use_error_toast';
import { useKibana } from '../common/lib/kibana';
@@ -21,7 +21,7 @@ export const useAgentDetails = ({ agentId }: UseAgentDetails) => {
const setErrorToast = useErrorToast();
return useQuery(
['agentDetails', agentId],
- () => http.get(agentRouteService.getInfoPath(agentId)),
+ () => http.get(`/internal/osquery/fleet_wrapper/agents/${agentId}`),
{
enabled: agentId.length > 0,
onSuccess: () => setErrorToast(),
diff --git a/x-pack/plugins/osquery/public/agents/use_agent_policies.ts b/x-pack/plugins/osquery/public/agents/use_agent_policies.ts
index 115b5af9d3a1b..e8d6fe7eb97ac 100644
--- a/x-pack/plugins/osquery/public/agents/use_agent_policies.ts
+++ b/x-pack/plugins/osquery/public/agents/use_agent_policies.ts
@@ -9,7 +9,7 @@ import { mapKeys } from 'lodash';
import { useQueries, UseQueryResult } from 'react-query';
import { i18n } from '@kbn/i18n';
import { useKibana } from '../common/lib/kibana';
-import { agentPolicyRouteService, GetOneAgentPolicyResponse } from '../../../fleet/common';
+import { GetOneAgentPolicyResponse } from '../../../fleet/common';
import { useErrorToast } from '../common/hooks/use_error_toast';
export const useAgentPolicies = (policyIds: string[] = []) => {
@@ -19,7 +19,7 @@ export const useAgentPolicies = (policyIds: string[] = []) => {
const agentResponse = useQueries(
policyIds.map((policyId) => ({
queryKey: ['agentPolicy', policyId],
- queryFn: () => http.get(agentPolicyRouteService.getInfoPath(policyId)),
+ queryFn: () => http.get(`/internal/osquery/fleet_wrapper/agent_policies/${policyId}`),
enabled: policyIds.length > 0,
onSuccess: () => setErrorToast(),
onError: (error) =>
diff --git a/x-pack/plugins/osquery/public/agents/use_agent_status.ts b/x-pack/plugins/osquery/public/agents/use_agent_status.ts
index c8bc8d2fe5c0e..ba2237dbe57ea 100644
--- a/x-pack/plugins/osquery/public/agents/use_agent_status.ts
+++ b/x-pack/plugins/osquery/public/agents/use_agent_status.ts
@@ -8,7 +8,7 @@
import { i18n } from '@kbn/i18n';
import { useQuery } from 'react-query';
-import { GetAgentStatusResponse, agentRouteService } from '../../../fleet/common';
+import { GetAgentStatusResponse } from '../../../fleet/common';
import { useErrorToast } from '../common/hooks/use_error_toast';
import { useKibana } from '../common/lib/kibana';
@@ -25,7 +25,7 @@ export const useAgentStatus = ({ policyId, skip }: UseAgentStatus) => {
['agentStatus', policyId],
() =>
http.get(
- agentRouteService.getStatusPath(),
+ `/internal/osquery/fleet_wrapper/agent-status`,
policyId
? {
query: {
diff --git a/x-pack/plugins/osquery/public/agents/use_all_agents.ts b/x-pack/plugins/osquery/public/agents/use_all_agents.ts
index fac43eaa7ffc3..42e4954989c66 100644
--- a/x-pack/plugins/osquery/public/agents/use_all_agents.ts
+++ b/x-pack/plugins/osquery/public/agents/use_all_agents.ts
@@ -8,7 +8,7 @@
import { i18n } from '@kbn/i18n';
import { useQuery } from 'react-query';
-import { GetAgentsResponse, agentRouteService } from '../../../fleet/common';
+import { GetAgentsResponse } from '../../../fleet/common';
import { useErrorToast } from '../common/hooks/use_error_toast';
import { useKibana } from '../common/lib/kibana';
@@ -31,7 +31,8 @@ export const useAllAgents = (
const { perPage } = opts;
const { http } = useKibana().services;
const setErrorToast = useErrorToast();
- const { isLoading: agentsLoading, data: agentData } = useQuery(
+
+ return useQuery(
['agents', osqueryPolicies, searchValue, perPage],
() => {
let kuery = `${osqueryPolicies.map((p) => `policy_id:${p}`).join(' or ')}`;
@@ -40,7 +41,7 @@ export const useAllAgents = (
kuery += ` and (local_metadata.host.hostname:*${searchValue}* or local_metadata.elastic.agent.id:*${searchValue}*)`;
}
- return http.get(agentRouteService.getListPath(), {
+ return http.get(`/internal/osquery/fleet_wrapper/agents`, {
query: {
kuery,
perPage,
@@ -48,6 +49,8 @@ export const useAllAgents = (
});
},
{
+ // @ts-expect-error update types
+ select: (data) => data?.agents || [],
enabled: !osqueryPoliciesLoading && osqueryPolicies.length > 0,
onSuccess: () => setErrorToast(),
onError: (error) =>
@@ -58,6 +61,4 @@ export const useAllAgents = (
}),
}
);
-
- return { agentsLoading, agents: agentData?.list };
};
diff --git a/x-pack/plugins/osquery/public/agents/use_osquery_policies.ts b/x-pack/plugins/osquery/public/agents/use_osquery_policies.ts
index 9064dac1ae5d0..4b9ff931f3a91 100644
--- a/x-pack/plugins/osquery/public/agents/use_osquery_policies.ts
+++ b/x-pack/plugins/osquery/public/agents/use_osquery_policies.ts
@@ -10,8 +10,6 @@ import { useQuery } from 'react-query';
import { useMemo } from 'react';
import { i18n } from '@kbn/i18n';
import { useKibana } from '../common/lib/kibana';
-import { packagePolicyRouteService, PACKAGE_POLICY_SAVED_OBJECT_TYPE } from '../../../fleet/common';
-import { OSQUERY_INTEGRATION_NAME } from '../../common';
import { useErrorToast } from '../common/hooks/use_error_toast';
export const useOsqueryPolicies = () => {
@@ -20,12 +18,7 @@ export const useOsqueryPolicies = () => {
const { isLoading: osqueryPoliciesLoading, data: osqueryPolicies = [] } = useQuery(
['osqueryPolicies'],
- () =>
- http.get(packagePolicyRouteService.getListPath(), {
- query: {
- kuery: `${PACKAGE_POLICY_SAVED_OBJECT_TYPE}.package.name:${OSQUERY_INTEGRATION_NAME}`,
- },
- }),
+ () => http.get('/internal/osquery/fleet_wrapper/package_policies'),
{
select: (response) =>
uniq(response.items.map((p: { policy_id: string }) => p.policy_id)),
diff --git a/x-pack/plugins/osquery/public/common/hooks/use_osquery_integration.tsx b/x-pack/plugins/osquery/public/common/hooks/use_osquery_integration.tsx
index 236fdb1af1815..58f9f8dbec61d 100644
--- a/x-pack/plugins/osquery/public/common/hooks/use_osquery_integration.tsx
+++ b/x-pack/plugins/osquery/public/common/hooks/use_osquery_integration.tsx
@@ -6,11 +6,8 @@
*/
import { i18n } from '@kbn/i18n';
-import { find } from 'lodash/fp';
import { useQuery } from 'react-query';
-import { GetPackagesResponse, epmRouteService } from '../../../../fleet/common';
-import { OSQUERY_INTEGRATION_NAME } from '../../../common';
import { useKibana } from '../lib/kibana';
import { useErrorToast } from './use_error_toast';
@@ -18,23 +15,12 @@ export const useOsqueryIntegration = () => {
const { http } = useKibana().services;
const setErrorToast = useErrorToast();
- return useQuery(
- 'integrations',
- () =>
- http.get(epmRouteService.getListPath(), {
- query: {
- experimental: true,
- },
- }),
- {
- select: ({ response }: GetPackagesResponse) =>
- find(['name', OSQUERY_INTEGRATION_NAME], response),
- onError: (error: Error) =>
- setErrorToast(error, {
- title: i18n.translate('xpack.osquery.osquery_integration.fetchError', {
- defaultMessage: 'Error while fetching osquery integration',
- }),
+ return useQuery('integration', () => http.get('/internal/osquery/status'), {
+ onError: (error: Error) =>
+ setErrorToast(error, {
+ title: i18n.translate('xpack.osquery.osquery_integration.fetchError', {
+ defaultMessage: 'Error while fetching osquery integration',
}),
- }
- );
+ }),
+ });
};
diff --git a/x-pack/plugins/osquery/public/editor/index.tsx b/x-pack/plugins/osquery/public/editor/index.tsx
index 5be2b1816ad86..8c844d9eda3bc 100644
--- a/x-pack/plugins/osquery/public/editor/index.tsx
+++ b/x-pack/plugins/osquery/public/editor/index.tsx
@@ -28,13 +28,13 @@ interface OsqueryEditorProps {
const OsqueryEditorComponent: React.FC = ({
defaultValue,
- // disabled,
+ disabled,
onChange,
}) => (
(
+ <>
+
+
+
+
+
+
+ >
+);
+
+export const DisabledCallout = React.memo(DisabledCalloutComponent);
diff --git a/x-pack/plugins/osquery/public/fleet_integration/osquery_managed_custom_button_extension.tsx b/x-pack/plugins/osquery/public/fleet_integration/osquery_managed_custom_button_extension.tsx
index 775b5c7a06d21..67791cb34e683 100644
--- a/x-pack/plugins/osquery/public/fleet_integration/osquery_managed_custom_button_extension.tsx
+++ b/x-pack/plugins/osquery/public/fleet_integration/osquery_managed_custom_button_extension.tsx
@@ -5,16 +5,42 @@
* 2.0.
*/
-import React from 'react';
+import { EuiLoadingContent } from '@elastic/eui';
+import React, { useEffect } from 'react';
import { PackageCustomExtensionComponentProps } from '../../../fleet/public';
import { NavigationButtons } from './navigation_buttons';
+import { DisabledCallout } from './disabled_callout';
+import { useKibana } from '../common/lib/kibana';
/**
* Exports Osquery-specific package policy instructions
* for use in the Fleet app custom tab
*/
export const OsqueryManagedCustomButtonExtension = React.memo(
- () =>
+ () => {
+ const [disabled, setDisabled] = React.useState(null);
+ const { http } = useKibana().services;
+
+ useEffect(() => {
+ const fetchStatus = () => {
+ http.get('/internal/osquery/status').then((response) => {
+ setDisabled(response.install_status !== 'installed');
+ });
+ };
+ fetchStatus();
+ }, [http]);
+
+ if (disabled === null) {
+ return ;
+ }
+
+ return (
+ <>
+ {disabled ? : null}
+
+ >
+ );
+ }
);
OsqueryManagedCustomButtonExtension.displayName = 'OsqueryManagedCustomButtonExtension';
diff --git a/x-pack/plugins/osquery/public/fleet_integration/osquery_managed_policy_create_import_extension.tsx b/x-pack/plugins/osquery/public/fleet_integration/osquery_managed_policy_create_import_extension.tsx
index 63036f5f693f7..9fd3c9b032ef8 100644
--- a/x-pack/plugins/osquery/public/fleet_integration/osquery_managed_policy_create_import_extension.tsx
+++ b/x-pack/plugins/osquery/public/fleet_integration/osquery_managed_policy_create_import_extension.tsx
@@ -11,7 +11,6 @@ import React, { useEffect, useMemo, useState } from 'react';
import { useHistory, useLocation } from 'react-router-dom';
import { produce } from 'immer';
-import { i18n } from '@kbn/i18n';
import {
agentRouteService,
agentPolicyRouteService,
@@ -29,6 +28,7 @@ import {
import { ScheduledQueryGroupQueriesTable } from '../scheduled_query_groups/scheduled_query_group_queries_table';
import { useKibana } from '../common/lib/kibana';
import { NavigationButtons } from './navigation_buttons';
+import { DisabledCallout } from './disabled_callout';
import { OsqueryManagerPackagePolicy } from '../../common/types';
/**
@@ -163,22 +163,7 @@ export const OsqueryManagedPolicyCreateImportExtension = React.memo<
return (
<>
- {!editMode ? (
- <>
-
-
-
-
-
-
- >
- ) : null}
+ {!editMode ? : null}
{policyAgentsCount === 0 ? (
<>
diff --git a/x-pack/plugins/osquery/public/live_queries/form/index.tsx b/x-pack/plugins/osquery/public/live_queries/form/index.tsx
index 8654a74fecfb4..bf614ff4e9bcd 100644
--- a/x-pack/plugins/osquery/public/live_queries/form/index.tsx
+++ b/x-pack/plugins/osquery/public/live_queries/form/index.tsx
@@ -47,6 +47,7 @@ const LiveQueryFormComponent: React.FC = ({
defaultValue,
onSuccess,
}) => {
+ const permissions = useKibana().services.application.capabilities.osquery;
const { http } = useKibana().services;
const [showSavedQueryFlyout, setShowSavedQueryFlyout] = useState(false);
const setErrorToast = useErrorToast();
@@ -175,7 +176,12 @@ const LiveQueryFormComponent: React.FC = ({
{!agentId && (
= ({
[
agentId,
agentSelected,
+ permissions.writeSavedQueries,
handleShowSaveQueryFlout,
queryComponentProps,
queryValueProvided,
diff --git a/x-pack/plugins/osquery/public/live_queries/form/live_query_query_field.tsx b/x-pack/plugins/osquery/public/live_queries/form/live_query_query_field.tsx
index 070339bb58af2..c79fae9eb5d21 100644
--- a/x-pack/plugins/osquery/public/live_queries/form/live_query_query_field.tsx
+++ b/x-pack/plugins/osquery/public/live_queries/form/live_query_query_field.tsx
@@ -5,8 +5,9 @@
* 2.0.
*/
-import { EuiFormRow, EuiSpacer } from '@elastic/eui';
+import { EuiCodeBlock, EuiFormRow, EuiSpacer } from '@elastic/eui';
import React, { useCallback, useRef } from 'react';
+import styled from 'styled-components';
import { OsquerySchemaLink } from '../../components/osquery_schema_link';
import { FieldHook } from '../../shared_imports';
@@ -15,6 +16,11 @@ import {
SavedQueriesDropdown,
SavedQueriesDropdownRef,
} from '../../saved_queries/saved_queries_dropdown';
+import { useKibana } from '../../common/lib/kibana';
+
+const StyledEuiCodeBlock = styled(EuiCodeBlock)`
+ min-height: 150px;
+`;
interface LiveQueryQueryFieldProps {
disabled?: boolean;
@@ -22,6 +28,7 @@ interface LiveQueryQueryFieldProps {
}
const LiveQueryQueryFieldComponent: React.FC = ({ disabled, field }) => {
+ const permissions = useKibana().services.application.capabilities.osquery;
const { value, setValue, errors } = field;
const error = errors[0]?.message;
const savedQueriesDropdownRef = useRef(null);
@@ -46,12 +53,23 @@ const LiveQueryQueryFieldComponent: React.FC = ({ disa
<>
}>
-
+ {!permissions.writeLiveQueries ? (
+
+ {value}
+
+ ) : (
+
+ )}
>
diff --git a/x-pack/plugins/osquery/public/plugin.ts b/x-pack/plugins/osquery/public/plugin.ts
index 12f9025e406db..8555997d61787 100644
--- a/x-pack/plugins/osquery/public/plugin.ts
+++ b/x-pack/plugins/osquery/public/plugin.ts
@@ -5,7 +5,6 @@
* 2.0.
*/
-import { BehaviorSubject, Subject } from 'rxjs';
import {
AppMountParameters,
CoreSetup,
@@ -13,9 +12,6 @@ import {
PluginInitializerContext,
CoreStart,
DEFAULT_APP_CATEGORIES,
- AppStatus,
- AppNavLinkStatus,
- AppUpdater,
} from '../../../../src/core/public';
import { Storage } from '../../../../src/plugins/kibana_utils/public';
import {
@@ -25,7 +21,6 @@ import {
AppPluginStartDependencies,
} from './types';
import { OSQUERY_INTEGRATION_NAME, PLUGIN_NAME } from '../common';
-import { Installation } from '../../fleet/common';
import {
LazyOsqueryManagedPolicyCreateImportExtension,
LazyOsqueryManagedPolicyEditExtension,
@@ -33,48 +28,7 @@ import {
} from './fleet_integration';
import { getLazyOsqueryAction } from './shared_components';
-export function toggleOsqueryPlugin(
- updater$: Subject,
- http: CoreStart['http'],
- registerExtension?: StartPlugins['fleet']['registerExtension']
-) {
- if (http.anonymousPaths.isAnonymous(window.location.pathname)) {
- updater$.next(() => ({
- status: AppStatus.inaccessible,
- navLinkStatus: AppNavLinkStatus.hidden,
- }));
- return;
- }
-
- http
- .fetch(`/internal/osquery/status`)
- .then((response) => {
- const installed = response?.install_status === 'installed';
-
- if (installed && registerExtension) {
- registerExtension({
- package: OSQUERY_INTEGRATION_NAME,
- view: 'package-detail-custom',
- Component: LazyOsqueryManagedCustomButtonExtension,
- });
- }
-
- updater$.next(() => ({
- navLinkStatus: installed ? AppNavLinkStatus.visible : AppNavLinkStatus.hidden,
- }));
- })
- .catch(() => {
- updater$.next(() => ({
- status: AppStatus.inaccessible,
- navLinkStatus: AppNavLinkStatus.hidden,
- }));
- });
-}
-
export class OsqueryPlugin implements Plugin {
- private readonly appUpdater$ = new BehaviorSubject(() => ({
- navLinkStatus: AppNavLinkStatus.hidden,
- }));
private kibanaVersion: string;
private storage = new Storage(localStorage);
@@ -102,8 +56,6 @@ export class OsqueryPlugin implements Plugin ({
- status: AppStatus.inaccessible,
- navLinkStatus: AppNavLinkStatus.hidden,
- }));
+
+ registerExtension({
+ package: OSQUERY_INTEGRATION_NAME,
+ view: 'package-detail-custom',
+ Component: LazyOsqueryManagedCustomButtonExtension,
+ });
}
return {
diff --git a/x-pack/plugins/osquery/public/results/results_table.tsx b/x-pack/plugins/osquery/public/results/results_table.tsx
index d82737ab51e7c..d293847215d68 100644
--- a/x-pack/plugins/osquery/public/results/results_table.tsx
+++ b/x-pack/plugins/osquery/public/results/results_table.tsx
@@ -8,6 +8,7 @@
import { isEmpty, isEqual, keys, map } from 'lodash/fp';
import {
EuiCallOut,
+ EuiCode,
EuiDataGrid,
EuiDataGridSorting,
EuiDataGridProps,
@@ -31,6 +32,8 @@ import {
ViewResultsInLensAction,
ViewResultsActionButtonType,
} from '../scheduled_query_groups/scheduled_query_group_queries_table';
+import { useActionResultsPrivileges } from '../action_results/use_action_privileges';
+import { OSQUERY_INTEGRATION_NAME } from '../../common';
const DataContext = createContext([]);
@@ -49,6 +52,7 @@ const ResultsTableComponent: React.FC = ({
endDate,
}) => {
const [isLive, setIsLive] = useState(true);
+ const { data: hasActionResultsPrivileges } = useActionResultsPrivileges();
const {
// @ts-expect-error update types
data: { aggregations },
@@ -60,6 +64,7 @@ const ResultsTableComponent: React.FC = ({
direction: Direction.asc,
sortField: '@timestamp',
isLive,
+ skip: !hasActionResultsPrivileges,
});
const expired = useMemo(() => (!endDate ? false : new Date(endDate) < new Date()), [endDate]);
const { getUrlForApp } = useKibana().services.application;
@@ -104,6 +109,7 @@ const ResultsTableComponent: React.FC = ({
field: sortedColumn.id,
direction: sortedColumn.direction as Direction,
})),
+ skip: !hasActionResultsPrivileges,
});
const [visibleColumns, setVisibleColumns] = useState([]);
@@ -237,6 +243,17 @@ const ResultsTableComponent: React.FC = ({
]
);
+ if (!hasActionResultsPrivileges) {
+ return (
+
+
+ You're missing read privileges to read from
+ logs-{OSQUERY_INTEGRATION_NAME}.result*.
+
+
+ );
+ }
+
if (!isFetched) {
return ;
}
diff --git a/x-pack/plugins/osquery/public/routes/components/index.ts b/x-pack/plugins/osquery/public/routes/components/index.ts
new file mode 100644
index 0000000000000..877c25fe7cdad
--- /dev/null
+++ b/x-pack/plugins/osquery/public/routes/components/index.ts
@@ -0,0 +1,8 @@
+/*
+ * 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.
+ */
+
+export * from './missing_privileges';
diff --git a/x-pack/plugins/osquery/public/routes/components/missing_privileges.tsx b/x-pack/plugins/osquery/public/routes/components/missing_privileges.tsx
new file mode 100644
index 0000000000000..6adabff599124
--- /dev/null
+++ b/x-pack/plugins/osquery/public/routes/components/missing_privileges.tsx
@@ -0,0 +1,47 @@
+/*
+ * 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 React from 'react';
+import { EuiEmptyPrompt, EuiPanel, EuiSpacer } from '@elastic/eui';
+import { FormattedMessage } from '@kbn/i18n/react';
+import styled from 'styled-components';
+
+const Panel = styled(EuiPanel)`
+ max-width: 500px;
+ margin-right: auto;
+ margin-left: auto;
+`;
+
+const MissingPrivilegesComponent = () => (
+
+
+
+
+
+
+ }
+ body={
+
+
+
+ }
+ />
+
+
+
+);
+
+export const MissingPrivileges = React.memo(MissingPrivilegesComponent);
diff --git a/x-pack/plugins/osquery/public/routes/live_queries/index.tsx b/x-pack/plugins/osquery/public/routes/live_queries/index.tsx
index af039e85e9785..47815516dd726 100644
--- a/x-pack/plugins/osquery/public/routes/live_queries/index.tsx
+++ b/x-pack/plugins/osquery/public/routes/live_queries/index.tsx
@@ -12,15 +12,26 @@ import { LiveQueriesPage } from './list';
import { NewLiveQueryPage } from './new';
import { LiveQueryDetailsPage } from './details';
import { useBreadcrumbs } from '../../common/hooks/use_breadcrumbs';
+import { useKibana } from '../../common/lib/kibana';
+import { MissingPrivileges } from '../components';
const LiveQueriesComponent = () => {
+ const permissions = useKibana().services.application.capabilities.osquery;
useBreadcrumbs('live_queries');
const match = useRouteMatch();
+ if (!permissions.readLiveQueries) {
+ return ;
+ }
+
return (
-
+ {permissions.runSavedQueries || permissions.writeLiveQueries ? (
+
+ ) : (
+
+ )}
diff --git a/x-pack/plugins/osquery/public/routes/live_queries/list/index.tsx b/x-pack/plugins/osquery/public/routes/live_queries/list/index.tsx
index 90ac7b5cc17ae..23bc44b455405 100644
--- a/x-pack/plugins/osquery/public/routes/live_queries/list/index.tsx
+++ b/x-pack/plugins/osquery/public/routes/live_queries/list/index.tsx
@@ -9,13 +9,14 @@ import { EuiButton, EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import React, { useMemo } from 'react';
-import { useRouterNavigate } from '../../../common/lib/kibana';
+import { useKibana, useRouterNavigate } from '../../../common/lib/kibana';
import { ActionsTable } from '../../../actions/actions_table';
import { WithHeaderLayout } from '../../../components/layouts';
import { useBreadcrumbs } from '../../../common/hooks/use_breadcrumbs';
import { BetaBadge, BetaBadgeRowWrapper } from '../../../components/beta_badge';
const LiveQueriesPageComponent = () => {
+ const permissions = useKibana().services.application.capabilities.osquery;
useBreadcrumbs('live_queries');
const newQueryLinkProps = useRouterNavigate('live_queries/new');
@@ -40,14 +41,19 @@ const LiveQueriesPageComponent = () => {
const RightColumn = useMemo(
() => (
-
+
),
- [newQueryLinkProps]
+ [permissions.writeLiveQueries, permissions.runSavedQueries, newQueryLinkProps]
);
return (
diff --git a/x-pack/plugins/osquery/public/routes/saved_queries/edit/form.tsx b/x-pack/plugins/osquery/public/routes/saved_queries/edit/form.tsx
index 8d77b7819bd3e..a7596575b90c4 100644
--- a/x-pack/plugins/osquery/public/routes/saved_queries/edit/form.tsx
+++ b/x-pack/plugins/osquery/public/routes/saved_queries/edit/form.tsx
@@ -24,11 +24,13 @@ import { useSavedQueryForm } from '../../../saved_queries/form/use_saved_query_f
interface EditSavedQueryFormProps {
defaultValue?: unknown;
handleSubmit: () => Promise;
+ viewMode?: boolean;
}
const EditSavedQueryFormComponent: React.FC = ({
defaultValue,
handleSubmit,
+ viewMode,
}) => {
const savedQueryListProps = useRouterNavigate('saved_queries');
@@ -39,41 +41,45 @@ const EditSavedQueryFormComponent: React.FC = ({
return (
);
};
diff --git a/x-pack/plugins/osquery/public/routes/saved_queries/edit/index.tsx b/x-pack/plugins/osquery/public/routes/saved_queries/edit/index.tsx
index 5bdba133fad72..401966460a7e7 100644
--- a/x-pack/plugins/osquery/public/routes/saved_queries/edit/index.tsx
+++ b/x-pack/plugins/osquery/public/routes/saved_queries/edit/index.tsx
@@ -17,7 +17,7 @@ import React, { useCallback, useMemo, useState } from 'react';
import { FormattedMessage } from '@kbn/i18n/react';
import { useParams } from 'react-router-dom';
-import { useRouterNavigate } from '../../../common/lib/kibana';
+import { useKibana, useRouterNavigate } from '../../../common/lib/kibana';
import { WithHeaderLayout } from '../../../components/layouts';
import { useBreadcrumbs } from '../../../common/hooks/use_breadcrumbs';
import { BetaBadge, BetaBadgeRowWrapper } from '../../../components/beta_badge';
@@ -25,6 +25,8 @@ import { EditSavedQueryForm } from './form';
import { useDeleteSavedQuery, useUpdateSavedQuery, useSavedQuery } from '../../../saved_queries';
const EditSavedQueryPageComponent = () => {
+ const permissions = useKibana().services.application.capabilities.osquery;
+
const [isDeleteModalVisible, setIsDeleteModalVisible] = useState(false);
const { savedQueryId } = useParams<{ savedQueryId: string }>();
const savedQueryListProps = useRouterNavigate('saved_queries');
@@ -35,6 +37,8 @@ const EditSavedQueryPageComponent = () => {
useBreadcrumbs('saved_query_edit', { savedQueryName: savedQueryDetails?.attributes?.id ?? '' });
+ const viewMode = useMemo(() => !permissions.writeSavedQueries, [permissions.writeSavedQueries]);
+
const handleCloseDeleteConfirmationModal = useCallback(() => {
setIsDeleteModalVisible(false);
}, []);
@@ -63,21 +67,32 @@ const EditSavedQueryPageComponent = () => {
-
+ {viewMode ? (
+
+ ) : (
+
+ )}
),
- [savedQueryDetails?.attributes?.id, savedQueryListProps]
+ [savedQueryDetails?.attributes?.id, savedQueryListProps, viewMode]
);
const RightColumn = useMemo(
@@ -95,12 +110,17 @@ const EditSavedQueryPageComponent = () => {
if (isLoading) return null;
return (
-
+
{!isLoading && !isEmpty(savedQueryDetails) && (
)}
{isDeleteModalVisible ? (
diff --git a/x-pack/plugins/osquery/public/routes/saved_queries/index.tsx b/x-pack/plugins/osquery/public/routes/saved_queries/index.tsx
index f986129bdfefc..a2241ae017df4 100644
--- a/x-pack/plugins/osquery/public/routes/saved_queries/index.tsx
+++ b/x-pack/plugins/osquery/public/routes/saved_queries/index.tsx
@@ -12,15 +12,22 @@ import { QueriesPage } from './list';
import { NewSavedQueryPage } from './new';
import { EditSavedQueryPage } from './edit';
import { useBreadcrumbs } from '../../common/hooks/use_breadcrumbs';
+import { MissingPrivileges } from '../components';
+import { useKibana } from '../../common/lib/kibana';
const SavedQueriesComponent = () => {
+ const permissions = useKibana().services.application.capabilities.osquery;
useBreadcrumbs('saved_queries');
const match = useRouteMatch();
+ if (!permissions.readSavedQueries) {
+ return ;
+ }
+
return (
-
+ {permissions.writeSavedQueries ? : }
diff --git a/x-pack/plugins/osquery/public/routes/saved_queries/list/index.tsx b/x-pack/plugins/osquery/public/routes/saved_queries/list/index.tsx
index 0c04e816dae7a..e82dcf85780e1 100644
--- a/x-pack/plugins/osquery/public/routes/saved_queries/list/index.tsx
+++ b/x-pack/plugins/osquery/public/routes/saved_queries/list/index.tsx
@@ -21,16 +21,63 @@ import { useHistory } from 'react-router-dom';
import { SavedObject } from 'kibana/public';
import { WithHeaderLayout } from '../../../components/layouts';
import { useBreadcrumbs } from '../../../common/hooks/use_breadcrumbs';
-import { useRouterNavigate } from '../../../common/lib/kibana';
+import { useKibana, useRouterNavigate } from '../../../common/lib/kibana';
import { BetaBadge, BetaBadgeRowWrapper } from '../../../components/beta_badge';
import { useSavedQueries } from '../../../saved_queries/use_saved_queries';
+interface PlayButtonProps {
+ disabled: boolean;
+ savedQueryId: string;
+ savedQueryName: string;
+}
+
+const PlayButtonComponent: React.FC = ({
+ disabled = false,
+ savedQueryId,
+ savedQueryName,
+}) => {
+ const { push } = useHistory();
+
+ // TODO: Fix href
+ const handlePlayClick = useCallback(
+ () =>
+ push('/live_queries/new', {
+ form: {
+ savedQueryId,
+ },
+ }),
+ [push, savedQueryId]
+ );
+
+ return (
+
+ );
+};
+
+const PlayButton = React.memo(PlayButtonComponent);
+
interface EditButtonProps {
+ disabled?: boolean;
savedQueryId: string;
savedQueryName: string;
}
-const EditButtonComponent: React.FC = ({ savedQueryId, savedQueryName }) => {
+const EditButtonComponent: React.FC = ({
+ disabled = false,
+ savedQueryId,
+ savedQueryName,
+}) => {
const buttonProps = useRouterNavigate(`saved_queries/${savedQueryId}`);
return (
@@ -38,6 +85,7 @@ const EditButtonComponent: React.FC = ({ savedQueryId, savedQue
color="primary"
{...buttonProps}
iconType="pencil"
+ isDisabled={disabled}
aria-label={i18n.translate('xpack.osquery.savedQueryList.queriesTable.editActionAriaLabel', {
defaultMessage: 'Edit {savedQueryName}',
values: {
@@ -51,8 +99,9 @@ const EditButtonComponent: React.FC = ({ savedQueryId, savedQue
const EditButton = React.memo(EditButtonComponent);
const SavedQueriesPageComponent = () => {
+ const permissions = useKibana().services.application.capabilities.osquery;
+
useBreadcrumbs('saved_queries');
- const { push } = useHistory();
const newQueryLinkProps = useRouterNavigate('saved_queries/new');
const [pageIndex, setPageIndex] = useState(0);
const [pageSize, setPageSize] = useState(20);
@@ -61,16 +110,6 @@ const SavedQueriesPageComponent = () => {
const { data } = useSavedQueries({ isLive: true });
- const handlePlayClick = useCallback(
- (item) =>
- push('/live_queries/new', {
- form: {
- savedQueryId: item.id,
- },
- }),
- [push]
- );
-
const renderEditAction = useCallback(
(item: SavedObject<{ name: string }>) => (
@@ -78,6 +117,17 @@ const SavedQueriesPageComponent = () => {
[]
);
+ const renderPlayAction = useCallback(
+ (item: SavedObject<{ name: string }>) => (
+
+ ),
+ [permissions.runSavedQueries, permissions.writeLiveQueries]
+ );
+
const renderUpdatedAt = useCallback((updatedAt, item) => {
if (!updatedAt) return '-';
@@ -128,17 +178,10 @@ const SavedQueriesPageComponent = () => {
name: i18n.translate('xpack.osquery.savedQueries.table.actionsColumnTitle', {
defaultMessage: 'Actions',
}),
- actions: [
- {
- type: 'icon',
- icon: 'play',
- onClick: handlePlayClick,
- },
- { render: renderEditAction },
- ],
+ actions: [{ render: renderPlayAction }, { render: renderEditAction }],
},
],
- [handlePlayClick, renderEditAction, renderUpdatedAt]
+ [renderEditAction, renderPlayAction, renderUpdatedAt]
);
const onTableChange = useCallback(({ page = {}, sort = {} }) => {
@@ -189,14 +232,19 @@ const SavedQueriesPageComponent = () => {
const RightColumn = useMemo(
() => (
-
+
),
- [newQueryLinkProps]
+ [permissions.writeSavedQueries, newQueryLinkProps]
);
return (
diff --git a/x-pack/plugins/osquery/public/routes/scheduled_query_groups/details/index.tsx b/x-pack/plugins/osquery/public/routes/scheduled_query_groups/details/index.tsx
index 960de043eac6e..dc6df49615093 100644
--- a/x-pack/plugins/osquery/public/routes/scheduled_query_groups/details/index.tsx
+++ b/x-pack/plugins/osquery/public/routes/scheduled_query_groups/details/index.tsx
@@ -21,7 +21,7 @@ import React, { useMemo } from 'react';
import { useParams } from 'react-router-dom';
import styled from 'styled-components';
-import { useRouterNavigate } from '../../../common/lib/kibana';
+import { useKibana, useRouterNavigate } from '../../../common/lib/kibana';
import { WithHeaderLayout } from '../../../components/layouts';
import { useScheduledQueryGroup } from '../../../scheduled_query_groups/use_scheduled_query_group';
import { ScheduledQueryGroupQueriesTable } from '../../../scheduled_query_groups/scheduled_query_group_queries_table';
@@ -36,6 +36,7 @@ const Divider = styled.div`
`;
const ScheduledQueryGroupDetailsPageComponent = () => {
+ const permissions = useKibana().services.application.capabilities.osquery;
const { scheduledQueryGroupId } = useParams<{ scheduledQueryGroupId: string }>();
const scheduledQueryGroupsListProps = useRouterNavigate('scheduled_query_groups');
const editQueryLinkProps = useRouterNavigate(
@@ -111,7 +112,12 @@ const ScheduledQueryGroupDetailsPageComponent = () => {
-
+
{
),
- [data?.policy_id, editQueryLinkProps]
+ [data?.policy_id, editQueryLinkProps, permissions]
);
return (
diff --git a/x-pack/plugins/osquery/public/routes/scheduled_query_groups/index.tsx b/x-pack/plugins/osquery/public/routes/scheduled_query_groups/index.tsx
index 76ca2bf14d303..53bf4ae79a908 100644
--- a/x-pack/plugins/osquery/public/routes/scheduled_query_groups/index.tsx
+++ b/x-pack/plugins/osquery/public/routes/scheduled_query_groups/index.tsx
@@ -13,18 +13,25 @@ import { AddScheduledQueryGroupPage } from './add';
import { EditScheduledQueryGroupPage } from './edit';
import { ScheduledQueryGroupDetailsPage } from './details';
import { useBreadcrumbs } from '../../common/hooks/use_breadcrumbs';
+import { useKibana } from '../../common/lib/kibana';
+import { MissingPrivileges } from '../components';
const ScheduledQueryGroupsComponent = () => {
+ const permissions = useKibana().services.application.capabilities.osquery;
useBreadcrumbs('scheduled_query_groups');
const match = useRouteMatch();
+ if (!permissions.readPacks) {
+ return ;
+ }
+
return (
-
+ {permissions.writePacks ? : }
-
+ {permissions.writePacks ? : }
diff --git a/x-pack/plugins/osquery/public/routes/scheduled_query_groups/list/index.tsx b/x-pack/plugins/osquery/public/routes/scheduled_query_groups/list/index.tsx
index b02ef95498b5c..006dd0e6ec1b6 100644
--- a/x-pack/plugins/osquery/public/routes/scheduled_query_groups/list/index.tsx
+++ b/x-pack/plugins/osquery/public/routes/scheduled_query_groups/list/index.tsx
@@ -9,12 +9,13 @@ import { EuiButton, EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import React, { useMemo } from 'react';
-import { useRouterNavigate } from '../../../common/lib/kibana';
+import { useKibana, useRouterNavigate } from '../../../common/lib/kibana';
import { WithHeaderLayout } from '../../../components/layouts';
import { ScheduledQueryGroupsTable } from '../../../scheduled_query_groups/scheduled_query_groups_table';
import { BetaBadge, BetaBadgeRowWrapper } from '../../../components/beta_badge';
const ScheduledQueryGroupsPageComponent = () => {
+ const permissions = useKibana().services.application.capabilities.osquery;
const newQueryLinkProps = useRouterNavigate('scheduled_query_groups/add');
const LeftColumn = useMemo(
@@ -38,14 +39,19 @@ const ScheduledQueryGroupsPageComponent = () => {
const RightColumn = useMemo(
() => (
-
+
),
- [newQueryLinkProps]
+ [newQueryLinkProps, permissions.writePacks]
);
return (
diff --git a/x-pack/plugins/osquery/public/saved_queries/form/index.tsx b/x-pack/plugins/osquery/public/saved_queries/form/index.tsx
index 9bbf847c4d2a0..beff34a8919a0 100644
--- a/x-pack/plugins/osquery/public/saved_queries/form/index.tsx
+++ b/x-pack/plugins/osquery/public/saved_queries/form/index.tsx
@@ -6,7 +6,7 @@
*/
import { EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiTitle, EuiText } from '@elastic/eui';
-import React from 'react';
+import React, { useMemo } from 'react';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
@@ -17,64 +17,78 @@ import { CodeEditorField } from './code_editor_field';
export const CommonUseField = getUseField({ component: Field });
-const SavedQueryFormComponent = () => (
- <>
-
-
-
-
-
-
-
-
-
-
+interface SavedQueryFormProps {
+ viewMode?: boolean;
+}
+
+const SavedQueryFormComponent: React.FC = ({ viewMode }) => {
+ const euiFieldProps = useMemo(
+ () => ({
+ isDisabled: !!viewMode,
+ }),
+ [viewMode]
+ );
+
+ return (
+ <>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- >
-);
+
+
+
+
+
+
+ >
+ );
+};
export const SavedQueryForm = React.memo(SavedQueryFormComponent);
diff --git a/x-pack/plugins/osquery/public/scheduled_query_groups/active_state_switch.tsx b/x-pack/plugins/osquery/public/scheduled_query_groups/active_state_switch.tsx
index bcb47d0adc833..7f26534626b12 100644
--- a/x-pack/plugins/osquery/public/scheduled_query_groups/active_state_switch.tsx
+++ b/x-pack/plugins/osquery/public/scheduled_query_groups/active_state_switch.tsx
@@ -28,12 +28,16 @@ const StyledEuiLoadingSpinner = styled(EuiLoadingSpinner)`
`;
interface ActiveStateSwitchProps {
+ disabled?: boolean;
item: PackagePolicy;
}
const ActiveStateSwitchComponent: React.FC = ({ item }) => {
const queryClient = useQueryClient();
const {
+ application: {
+ capabilities: { osquery: permissions },
+ },
http,
notifications: { toasts },
} = useKibana().services;
@@ -126,7 +130,7 @@ const ActiveStateSwitchComponent: React.FC = ({ item })
{isLoading && }
(
['scheduledQueryGroup', { scheduledQueryGroupId }],
- () => http.get(packagePolicyRouteService.getInfoPath(scheduledQueryGroupId)),
+ () => http.get(`/internal/osquery/scheduled_query_group/${scheduledQueryGroupId}`),
{
keepPreviousData: true,
enabled: !skip || !scheduledQueryGroupId,
diff --git a/x-pack/plugins/osquery/public/scheduled_query_groups/use_scheduled_query_groups.ts b/x-pack/plugins/osquery/public/scheduled_query_groups/use_scheduled_query_groups.ts
index 3302d8e621eb7..01b67a3d5164a 100644
--- a/x-pack/plugins/osquery/public/scheduled_query_groups/use_scheduled_query_groups.ts
+++ b/x-pack/plugins/osquery/public/scheduled_query_groups/use_scheduled_query_groups.ts
@@ -9,12 +9,7 @@ import { produce } from 'immer';
import { useQuery } from 'react-query';
import { useKibana } from '../common/lib/kibana';
-import {
- ListResult,
- PackagePolicy,
- packagePolicyRouteService,
- PACKAGE_POLICY_SAVED_OBJECT_TYPE,
-} from '../../../fleet/common';
+import { ListResult, PackagePolicy, PACKAGE_POLICY_SAVED_OBJECT_TYPE } from '../../../fleet/common';
import { OSQUERY_INTEGRATION_NAME } from '../../common';
export const useScheduledQueryGroups = () => {
@@ -23,7 +18,7 @@ export const useScheduledQueryGroups = () => {
return useQuery>(
['scheduledQueries'],
() =>
- http.get(packagePolicyRouteService.getListPath(), {
+ http.get('/internal/osquery/scheduled_query_group', {
query: {
page: 1,
perPage: 10000,
diff --git a/x-pack/plugins/osquery/server/lib/osquery_app_context_services.ts b/x-pack/plugins/osquery/server/lib/osquery_app_context_services.ts
index 6ebf469b8fb29..ca4fd1ebeffd2 100644
--- a/x-pack/plugins/osquery/server/lib/osquery_app_context_services.ts
+++ b/x-pack/plugins/osquery/server/lib/osquery_app_context_services.ts
@@ -5,7 +5,7 @@
* 2.0.
*/
-import { Logger, LoggerFactory } from 'src/core/server';
+import { CoreSetup, Logger, LoggerFactory } from '../../../../../src/core/server';
import { SecurityPluginStart } from '../../../security/server';
import {
AgentService,
@@ -71,6 +71,7 @@ export interface OsqueryAppContext {
logFactory: LoggerFactory;
config(): ConfigType;
security: SecurityPluginStart;
+ getStartServices: CoreSetup['getStartServices'];
/**
* Object readiness is tied to plugin start method
*/
diff --git a/x-pack/plugins/osquery/server/plugin.ts b/x-pack/plugins/osquery/server/plugin.ts
index 6bc12f5736e5e..ff8483fdb385a 100644
--- a/x-pack/plugins/osquery/server/plugin.ts
+++ b/x-pack/plugins/osquery/server/plugin.ts
@@ -5,14 +5,20 @@
* 2.0.
*/
+import { i18n } from '@kbn/i18n';
+import {
+ PACKAGE_POLICY_SAVED_OBJECT_TYPE,
+ AGENT_POLICY_SAVED_OBJECT_TYPE,
+ PACKAGES_SAVED_OBJECT_TYPE,
+} from '../../fleet/common';
import {
PluginInitializerContext,
CoreSetup,
CoreStart,
Plugin,
Logger,
+ DEFAULT_APP_CATEGORIES,
} from '../../../../src/core/server';
-
import { createConfig } from './create_config';
import { OsqueryPluginSetup, OsqueryPluginStart, SetupPlugins, StartPlugins } from './types';
import { defineRoutes } from './routes';
@@ -21,6 +27,169 @@ import { initSavedObjects } from './saved_objects';
import { initUsageCollectors } from './usage';
import { OsqueryAppContext, OsqueryAppContextService } from './lib/osquery_app_context_services';
import { ConfigType } from './config';
+import { packSavedObjectType, savedQuerySavedObjectType } from '../common/types';
+import { PLUGIN_ID } from '../common';
+
+const registerFeatures = (features: SetupPlugins['features']) => {
+ features.registerKibanaFeature({
+ id: PLUGIN_ID,
+ name: i18n.translate('xpack.osquery.features.osqueryFeatureName', {
+ defaultMessage: 'Osquery',
+ }),
+ category: DEFAULT_APP_CATEGORIES.management,
+ app: [PLUGIN_ID, 'kibana'],
+ catalogue: [PLUGIN_ID],
+ order: 2300,
+ excludeFromBasePrivileges: true,
+ privileges: {
+ all: {
+ api: [`${PLUGIN_ID}-read`, `${PLUGIN_ID}-write`],
+ app: [PLUGIN_ID, 'kibana'],
+ catalogue: [PLUGIN_ID],
+ savedObject: {
+ all: [PACKAGE_POLICY_SAVED_OBJECT_TYPE],
+ read: [PACKAGES_SAVED_OBJECT_TYPE, AGENT_POLICY_SAVED_OBJECT_TYPE],
+ },
+ ui: ['write'],
+ },
+ read: {
+ api: [`${PLUGIN_ID}-read`],
+ app: [PLUGIN_ID, 'kibana'],
+ catalogue: [PLUGIN_ID],
+ savedObject: {
+ all: [],
+ read: [
+ PACKAGE_POLICY_SAVED_OBJECT_TYPE,
+ PACKAGES_SAVED_OBJECT_TYPE,
+ AGENT_POLICY_SAVED_OBJECT_TYPE,
+ ],
+ },
+ ui: ['read'],
+ },
+ },
+ subFeatures: [
+ {
+ name: i18n.translate('xpack.osquery.features.liveQueriesSubFeatureName', {
+ defaultMessage: 'Live queries',
+ }),
+ privilegeGroups: [
+ {
+ groupType: 'mutually_exclusive',
+ privileges: [
+ {
+ api: [`${PLUGIN_ID}-writeLiveQueries`, `${PLUGIN_ID}-readLiveQueries`],
+ id: 'live_queries_all',
+ includeIn: 'all',
+ name: 'All',
+ savedObject: {
+ all: [],
+ read: [],
+ },
+ ui: ['writeLiveQueries', 'readLiveQueries'],
+ },
+ {
+ api: [`${PLUGIN_ID}-readLiveQueries`],
+ id: 'live_queries_read',
+ includeIn: 'read',
+ name: 'Read',
+ savedObject: {
+ all: [],
+ read: [],
+ },
+ ui: ['readLiveQueries'],
+ },
+ ],
+ },
+ {
+ groupType: 'independent',
+ privileges: [
+ {
+ api: [`${PLUGIN_ID}-runSavedQueries`],
+ id: 'run_saved_queries',
+ name: i18n.translate('xpack.osquery.features.runSavedQueriesPrivilegeName', {
+ defaultMessage: 'Run Saved queries',
+ }),
+ includeIn: 'all',
+ savedObject: {
+ all: [],
+ read: [],
+ },
+ ui: ['runSavedQueries'],
+ },
+ ],
+ },
+ ],
+ },
+ {
+ name: i18n.translate('xpack.osquery.features.savedQueriesSubFeatureName', {
+ defaultMessage: 'Saved queries',
+ }),
+ privilegeGroups: [
+ {
+ groupType: 'mutually_exclusive',
+ privileges: [
+ {
+ id: 'saved_queries_all',
+ includeIn: 'all',
+ name: 'All',
+ savedObject: {
+ all: [savedQuerySavedObjectType],
+ read: [],
+ },
+ ui: ['writeSavedQueries', 'readSavedQueries'],
+ },
+ {
+ id: 'saved_queries_read',
+ includeIn: 'read',
+ name: 'Read',
+ savedObject: {
+ all: [],
+ read: [savedQuerySavedObjectType],
+ },
+ ui: ['readSavedQueries'],
+ },
+ ],
+ },
+ ],
+ },
+ {
+ // TODO: Rename it to "Packs" as part of https://github.com/elastic/kibana/pull/107345
+ name: i18n.translate('xpack.osquery.features.scheduledQueryGroupsSubFeatureName', {
+ defaultMessage: 'Scheduled query groups',
+ }),
+ privilegeGroups: [
+ {
+ groupType: 'mutually_exclusive',
+ privileges: [
+ {
+ api: [`${PLUGIN_ID}-writePacks`],
+ id: 'packs_all',
+ includeIn: 'all',
+ name: 'All',
+ savedObject: {
+ all: [packSavedObjectType],
+ read: [],
+ },
+ ui: ['writePacks', 'readPacks'],
+ },
+ {
+ api: [`${PLUGIN_ID}-readPacks`],
+ id: 'packs_read',
+ includeIn: 'read',
+ name: 'Read',
+ savedObject: {
+ all: [],
+ read: [packSavedObjectType],
+ },
+ ui: ['readPacks'],
+ },
+ ],
+ },
+ ],
+ },
+ ],
+ });
+};
export class OsqueryPlugin implements Plugin {
private readonly logger: Logger;
@@ -40,10 +209,13 @@ export class OsqueryPlugin implements Plugin config,
security: plugins.security,
diff --git a/x-pack/plugins/osquery/server/routes/action/create_action_route.ts b/x-pack/plugins/osquery/server/routes/action/create_action_route.ts
index 478bfc1053bdf..79c1149675b0d 100644
--- a/x-pack/plugins/osquery/server/routes/action/create_action_route.ts
+++ b/x-pack/plugins/osquery/server/routes/action/create_action_route.ts
@@ -8,6 +8,7 @@
import uuid from 'uuid';
import moment from 'moment';
+import { PLUGIN_ID } from '../../../common';
import { IRouter } from '../../../../../../src/core/server';
import { OsqueryAppContext } from '../../lib/osquery_app_context_services';
@@ -19,6 +20,7 @@ import {
} from '../../../common/schemas/routes/action/create_action_request_body_schema';
import { incrementCount } from '../usage';
+import { getInternalSavedObjectsClient } from '../../usage/collector';
export const createActionRoute = (router: IRouter, osqueryContext: OsqueryAppContext) => {
router.post(
@@ -30,10 +32,17 @@ export const createActionRoute = (router: IRouter, osqueryContext: OsqueryAppCon
CreateActionRequestBodySchema
>(createActionRequestBodySchema),
},
+ options: {
+ tags: [`access:${PLUGIN_ID}-readLiveQueries`, `access:${PLUGIN_ID}-runSavedQueries`],
+ },
},
async (context, request, response) => {
- const esClient = context.core.elasticsearch.client.asCurrentUser;
+ const esClient = context.core.elasticsearch.client.asInternalUser;
const soClient = context.core.savedObjects.client;
+ const internalSavedObjectsClient = await getInternalSavedObjectsClient(
+ osqueryContext.getStartServices
+ );
+
const { agentSelection } = request.body as { agentSelection: AgentSelection };
const selectedAgents = await parseAgentSelection(
esClient,
@@ -41,12 +50,14 @@ export const createActionRoute = (router: IRouter, osqueryContext: OsqueryAppCon
osqueryContext,
agentSelection
);
- incrementCount(soClient, 'live_query');
+ incrementCount(internalSavedObjectsClient, 'live_query');
if (!selectedAgents.length) {
- incrementCount(soClient, 'live_query', 'errors');
+ incrementCount(internalSavedObjectsClient, 'live_query', 'errors');
return response.badRequest({ body: new Error('No agents found for selection') });
}
+ // TODO: Add check for `runSavedQueries` only
+
try {
const currentUser = await osqueryContext.security.authc.getCurrentUser(request)?.username;
const action = {
@@ -74,7 +85,7 @@ export const createActionRoute = (router: IRouter, osqueryContext: OsqueryAppCon
},
});
} catch (error) {
- incrementCount(soClient, 'live_query', 'errors');
+ incrementCount(internalSavedObjectsClient, 'live_query', 'errors');
return response.customError({
statusCode: 500,
body: new Error(`Error occurred while processing ${error}`),
diff --git a/x-pack/plugins/osquery/server/routes/fleet_wrapper/get_agent_details.ts b/x-pack/plugins/osquery/server/routes/fleet_wrapper/get_agent_details.ts
new file mode 100644
index 0000000000000..67b4a27ab9ec7
--- /dev/null
+++ b/x-pack/plugins/osquery/server/routes/fleet_wrapper/get_agent_details.ts
@@ -0,0 +1,33 @@
+/*
+ * 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 { schema } from '@kbn/config-schema';
+import { PLUGIN_ID } from '../../../common';
+import { IRouter } from '../../../../../../src/core/server';
+import { OsqueryAppContext } from '../../lib/osquery_app_context_services';
+
+export const getAgentDetailsRoute = (router: IRouter, osqueryContext: OsqueryAppContext) => {
+ router.get(
+ {
+ path: '/internal/osquery/fleet_wrapper/agents/{id}',
+ validate: {
+ params: schema.object({}, { unknowns: 'allow' }),
+ },
+ options: { tags: [`access:${PLUGIN_ID}-read`] },
+ },
+ async (context, request, response) => {
+ const esClient = context.core.elasticsearch.client.asInternalUser;
+
+ const agent = await osqueryContext.service
+ .getAgentService()
+ // @ts-expect-error update types
+ ?.getAgent(esClient, request.params.id);
+
+ return response.ok({ body: { item: agent } });
+ }
+ );
+};
diff --git a/x-pack/plugins/osquery/server/routes/fleet_wrapper/get_agent_policies.ts b/x-pack/plugins/osquery/server/routes/fleet_wrapper/get_agent_policies.ts
new file mode 100644
index 0000000000000..e35e776cb1958
--- /dev/null
+++ b/x-pack/plugins/osquery/server/routes/fleet_wrapper/get_agent_policies.ts
@@ -0,0 +1,34 @@
+/*
+ * 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 { schema } from '@kbn/config-schema';
+import { PLUGIN_ID } from '../../../common';
+import { IRouter } from '../../../../../../src/core/server';
+import { OsqueryAppContext } from '../../lib/osquery_app_context_services';
+
+export const getAgentPoliciesRoute = (router: IRouter, osqueryContext: OsqueryAppContext) => {
+ router.get(
+ {
+ path: '/internal/osquery/fleet_wrapper/agent_policies',
+ validate: {
+ params: schema.object({}, { unknowns: 'allow' }),
+ query: schema.object({}, { unknowns: 'allow' }),
+ },
+ options: { tags: [`access:${PLUGIN_ID}-read`] },
+ },
+ async (context, request, response) => {
+ const soClient = context.core.savedObjects.client;
+
+ const agentPolicies = await osqueryContext.service.getAgentPolicyService()?.list(soClient, {
+ ...(request.query || {}),
+ perPage: 100,
+ });
+
+ return response.ok({ body: agentPolicies });
+ }
+ );
+};
diff --git a/x-pack/plugins/osquery/server/routes/fleet_wrapper/get_agent_policy.ts b/x-pack/plugins/osquery/server/routes/fleet_wrapper/get_agent_policy.ts
new file mode 100644
index 0000000000000..f845b04e99c93
--- /dev/null
+++ b/x-pack/plugins/osquery/server/routes/fleet_wrapper/get_agent_policy.ts
@@ -0,0 +1,34 @@
+/*
+ * 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 { schema } from '@kbn/config-schema';
+import { PLUGIN_ID } from '../../../common';
+import { IRouter } from '../../../../../../src/core/server';
+import { OsqueryAppContext } from '../../lib/osquery_app_context_services';
+
+export const getAgentPolicyRoute = (router: IRouter, osqueryContext: OsqueryAppContext) => {
+ router.get(
+ {
+ path: '/internal/osquery/fleet_wrapper/agent_policies/{id}',
+ validate: {
+ params: schema.object({
+ id: schema.string(),
+ }),
+ },
+ options: { tags: [`access:${PLUGIN_ID}-read`] },
+ },
+ async (context, request, response) => {
+ const soClient = context.core.savedObjects.client;
+
+ const packageInfo = await osqueryContext.service
+ .getAgentPolicyService()
+ ?.get(soClient, request.params.id);
+
+ return response.ok({ body: { item: packageInfo } });
+ }
+ );
+};
diff --git a/x-pack/plugins/osquery/server/routes/fleet_wrapper/get_agent_status_for_agent_policy.ts b/x-pack/plugins/osquery/server/routes/fleet_wrapper/get_agent_status_for_agent_policy.ts
new file mode 100644
index 0000000000000..dea4402472958
--- /dev/null
+++ b/x-pack/plugins/osquery/server/routes/fleet_wrapper/get_agent_status_for_agent_policy.ts
@@ -0,0 +1,46 @@
+/*
+ * 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 { schema } from '@kbn/config-schema';
+import { PLUGIN_ID } from '../../../common';
+import { GetAgentStatusResponse } from '../../../../fleet/common';
+import { IRouter } from '../../../../../../src/core/server';
+import { OsqueryAppContext } from '../../lib/osquery_app_context_services';
+
+export const getAgentStatusForAgentPolicyRoute = (
+ router: IRouter,
+ osqueryContext: OsqueryAppContext
+) => {
+ router.get(
+ {
+ path: '/internal/osquery/fleet_wrapper/agent-status',
+ validate: {
+ query: schema.object({
+ policyId: schema.string(),
+ kuery: schema.maybe(schema.string()),
+ }),
+ params: schema.object({}, { unknowns: 'allow' }),
+ },
+ options: { tags: [`access:${PLUGIN_ID}-read`] },
+ },
+ async (context, request, response) => {
+ const esClient = context.core.elasticsearch.client.asInternalUser;
+
+ const results = await osqueryContext.service
+ .getAgentService()
+ ?.getAgentStatusForAgentPolicy(esClient, request.query.policyId, request.query.kuery);
+
+ if (!results) {
+ return response.ok({ body: {} });
+ }
+
+ const body: GetAgentStatusResponse = { results };
+
+ return response.ok({ body });
+ }
+ );
+};
diff --git a/x-pack/plugins/osquery/server/routes/fleet_wrapper/get_agents.ts b/x-pack/plugins/osquery/server/routes/fleet_wrapper/get_agents.ts
new file mode 100644
index 0000000000000..d45cb26e0d199
--- /dev/null
+++ b/x-pack/plugins/osquery/server/routes/fleet_wrapper/get_agents.ts
@@ -0,0 +1,33 @@
+/*
+ * 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 { schema } from '@kbn/config-schema';
+import { PLUGIN_ID } from '../../../common';
+import { IRouter } from '../../../../../../src/core/server';
+import { OsqueryAppContext } from '../../lib/osquery_app_context_services';
+
+export const getAgentsRoute = (router: IRouter, osqueryContext: OsqueryAppContext) => {
+ router.get(
+ {
+ path: '/internal/osquery/fleet_wrapper/agents',
+ validate: {
+ query: schema.object({}, { unknowns: 'allow' }),
+ },
+ options: { tags: [`access:${PLUGIN_ID}-read`] },
+ },
+ async (context, request, response) => {
+ const esClient = context.core.elasticsearch.client.asInternalUser;
+
+ const agents = await osqueryContext.service
+ .getAgentService()
+ // @ts-expect-error update types
+ ?.listAgents(esClient, request.query);
+
+ return response.ok({ body: agents });
+ }
+ );
+};
diff --git a/x-pack/plugins/osquery/server/routes/scheduled_query/find_scheduled_query_route.ts b/x-pack/plugins/osquery/server/routes/fleet_wrapper/get_package_policies.ts
similarity index 81%
rename from x-pack/plugins/osquery/server/routes/scheduled_query/find_scheduled_query_route.ts
rename to x-pack/plugins/osquery/server/routes/fleet_wrapper/get_package_policies.ts
index 43d5f3fc893f0..b95dfbdfb9cb4 100644
--- a/x-pack/plugins/osquery/server/routes/scheduled_query/find_scheduled_query_route.ts
+++ b/x-pack/plugins/osquery/server/routes/fleet_wrapper/get_package_policies.ts
@@ -6,19 +6,19 @@
*/
import { schema } from '@kbn/config-schema';
-import { OSQUERY_INTEGRATION_NAME } from '../../../common';
-
+import { PLUGIN_ID, OSQUERY_INTEGRATION_NAME } from '../../../common';
import { IRouter } from '../../../../../../src/core/server';
import { PACKAGE_POLICY_SAVED_OBJECT_TYPE } from '../../../../fleet/common';
import { OsqueryAppContext } from '../../lib/osquery_app_context_services';
-export const findScheduledQueryRoute = (router: IRouter, osqueryContext: OsqueryAppContext) => {
+export const getPackagePoliciesRoute = (router: IRouter, osqueryContext: OsqueryAppContext) => {
router.get(
{
- path: '/internal/osquery/scheduled_query',
+ path: '/internal/osquery/fleet_wrapper/package_policies',
validate: {
query: schema.object({}, { unknowns: 'allow' }),
},
+ options: { tags: [`access:${PLUGIN_ID}-read`] },
},
async (context, request, response) => {
const kuery = `${PACKAGE_POLICY_SAVED_OBJECT_TYPE}.attributes.package.name: ${OSQUERY_INTEGRATION_NAME}`;
diff --git a/x-pack/plugins/osquery/server/routes/fleet_wrapper/index.ts b/x-pack/plugins/osquery/server/routes/fleet_wrapper/index.ts
new file mode 100644
index 0000000000000..1821e19da975e
--- /dev/null
+++ b/x-pack/plugins/osquery/server/routes/fleet_wrapper/index.ts
@@ -0,0 +1,24 @@
+/*
+ * 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 { IRouter } from '../../../../../../src/core/server';
+import { OsqueryAppContext } from '../../lib/osquery_app_context_services';
+import { getAgentPoliciesRoute } from './get_agent_policies';
+import { getAgentPolicyRoute } from './get_agent_policy';
+import { getAgentStatusForAgentPolicyRoute } from './get_agent_status_for_agent_policy';
+import { getPackagePoliciesRoute } from './get_package_policies';
+import { getAgentsRoute } from './get_agents';
+import { getAgentDetailsRoute } from './get_agent_details';
+
+export const initFleetWrapperRoutes = (router: IRouter, context: OsqueryAppContext) => {
+ getAgentDetailsRoute(router, context);
+ getAgentPoliciesRoute(router, context);
+ getAgentPolicyRoute(router, context);
+ getAgentStatusForAgentPolicyRoute(router, context);
+ getPackagePoliciesRoute(router, context);
+ getAgentsRoute(router, context);
+};
diff --git a/x-pack/plugins/osquery/server/routes/index.ts b/x-pack/plugins/osquery/server/routes/index.ts
index dd11141b2553f..c927c711a23cb 100644
--- a/x-pack/plugins/osquery/server/routes/index.ts
+++ b/x-pack/plugins/osquery/server/routes/index.ts
@@ -10,13 +10,19 @@ import { initActionRoutes } from './action';
import { OsqueryAppContext } from '../lib/osquery_app_context_services';
import { initSavedQueryRoutes } from './saved_query';
import { initStatusRoutes } from './status';
+import { initFleetWrapperRoutes } from './fleet_wrapper';
import { initPackRoutes } from './pack';
+import { initScheduledQueryGroupRoutes } from './scheduled_query_group';
+import { initPrivilegesCheckRoutes } from './privileges_check';
export const defineRoutes = (router: IRouter, context: OsqueryAppContext) => {
const config = context.config();
initActionRoutes(router, context);
initStatusRoutes(router, context);
+ initScheduledQueryGroupRoutes(router, context);
+ initFleetWrapperRoutes(router, context);
+ initPrivilegesCheckRoutes(router, context);
if (config.packs) {
initPackRoutes(router);
diff --git a/x-pack/plugins/osquery/server/routes/privileges_check/index.ts b/x-pack/plugins/osquery/server/routes/privileges_check/index.ts
new file mode 100644
index 0000000000000..8932b23b85f5a
--- /dev/null
+++ b/x-pack/plugins/osquery/server/routes/privileges_check/index.ts
@@ -0,0 +1,14 @@
+/*
+ * 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 { IRouter } from '../../../../../../src/core/server';
+import { privilegesCheckRoute } from './privileges_check_route';
+import { OsqueryAppContext } from '../../lib/osquery_app_context_services';
+
+export const initPrivilegesCheckRoutes = (router: IRouter, context: OsqueryAppContext) => {
+ privilegesCheckRoute(router, context);
+};
diff --git a/x-pack/plugins/osquery/server/routes/privileges_check/privileges_check_route.ts b/x-pack/plugins/osquery/server/routes/privileges_check/privileges_check_route.ts
new file mode 100644
index 0000000000000..80c335c1c46d3
--- /dev/null
+++ b/x-pack/plugins/osquery/server/routes/privileges_check/privileges_check_route.ts
@@ -0,0 +1,43 @@
+/*
+ * 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 { OSQUERY_INTEGRATION_NAME, PLUGIN_ID } from '../../../common';
+import { IRouter } from '../../../../../../src/core/server';
+import { OsqueryAppContext } from '../../lib/osquery_app_context_services';
+
+// eslint-disable-next-line @typescript-eslint/no-unused-vars
+export const privilegesCheckRoute = (router: IRouter, osqueryContext: OsqueryAppContext) => {
+ router.get(
+ {
+ path: '/internal/osquery/privileges_check',
+ validate: {},
+ options: {
+ tags: [`access:${PLUGIN_ID}-readLiveQueries`],
+ },
+ },
+ async (context, request, response) => {
+ const esClient = context.core.elasticsearch.client.asCurrentUser;
+
+ const privileges = (
+ await esClient.security.hasPrivileges({
+ body: {
+ index: [
+ {
+ names: [`logs-${OSQUERY_INTEGRATION_NAME}.result*`],
+ privileges: ['read'],
+ },
+ ],
+ },
+ })
+ ).body;
+
+ return response.ok({
+ body: privileges,
+ });
+ }
+ );
+};
diff --git a/x-pack/plugins/osquery/server/routes/saved_query/create_saved_query_route.ts b/x-pack/plugins/osquery/server/routes/saved_query/create_saved_query_route.ts
index a41cb7cc39b40..fe8220c559de8 100644
--- a/x-pack/plugins/osquery/server/routes/saved_query/create_saved_query_route.ts
+++ b/x-pack/plugins/osquery/server/routes/saved_query/create_saved_query_route.ts
@@ -6,7 +6,7 @@
*/
import { IRouter } from '../../../../../../src/core/server';
-
+import { PLUGIN_ID } from '../../../common';
import {
createSavedQueryRequestSchema,
CreateSavedQueryRequestSchemaDecoded,
@@ -24,6 +24,7 @@ export const createSavedQueryRoute = (router: IRouter) => {
CreateSavedQueryRequestSchemaDecoded
>(createSavedQueryRequestSchema),
},
+ options: { tags: [`access:${PLUGIN_ID}-writeSavedQueries`] },
},
async (context, request, response) => {
const savedObjectsClient = context.core.savedObjects.client;
diff --git a/x-pack/plugins/osquery/server/routes/saved_query/delete_saved_query_route.ts b/x-pack/plugins/osquery/server/routes/saved_query/delete_saved_query_route.ts
index 5b8e231ba61ec..a34db8c11ddc3 100644
--- a/x-pack/plugins/osquery/server/routes/saved_query/delete_saved_query_route.ts
+++ b/x-pack/plugins/osquery/server/routes/saved_query/delete_saved_query_route.ts
@@ -6,7 +6,7 @@
*/
import { schema } from '@kbn/config-schema';
-
+import { PLUGIN_ID } from '../../../common';
import { IRouter } from '../../../../../../src/core/server';
import { savedQuerySavedObjectType } from '../../../common/types';
@@ -17,6 +17,7 @@ export const deleteSavedQueryRoute = (router: IRouter) => {
validate: {
body: schema.object({}, { unknowns: 'allow' }),
},
+ options: { tags: [`access:${PLUGIN_ID}-writeSavedQueries`] },
},
async (context, request, response) => {
const savedObjectsClient = context.core.savedObjects.client;
diff --git a/x-pack/plugins/osquery/server/routes/saved_query/find_saved_query_route.ts b/x-pack/plugins/osquery/server/routes/saved_query/find_saved_query_route.ts
index 6d737ba0d0220..79d6927d06722 100644
--- a/x-pack/plugins/osquery/server/routes/saved_query/find_saved_query_route.ts
+++ b/x-pack/plugins/osquery/server/routes/saved_query/find_saved_query_route.ts
@@ -6,7 +6,7 @@
*/
import { schema } from '@kbn/config-schema';
-
+import { PLUGIN_ID } from '../../../common';
import { IRouter } from '../../../../../../src/core/server';
import { savedQuerySavedObjectType } from '../../../common/types';
@@ -17,6 +17,7 @@ export const findSavedQueryRoute = (router: IRouter) => {
validate: {
query: schema.object({}, { unknowns: 'allow' }),
},
+ options: { tags: [`access:${PLUGIN_ID}-readSavedQueries`] },
},
async (context, request, response) => {
const savedObjectsClient = context.core.savedObjects.client;
diff --git a/x-pack/plugins/osquery/server/routes/saved_query/read_saved_query_route.ts b/x-pack/plugins/osquery/server/routes/saved_query/read_saved_query_route.ts
index 2d399648df4cc..4157ed1582305 100644
--- a/x-pack/plugins/osquery/server/routes/saved_query/read_saved_query_route.ts
+++ b/x-pack/plugins/osquery/server/routes/saved_query/read_saved_query_route.ts
@@ -6,7 +6,7 @@
*/
import { schema } from '@kbn/config-schema';
-
+import { PLUGIN_ID } from '../../../common';
import { IRouter } from '../../../../../../src/core/server';
import { savedQuerySavedObjectType } from '../../../common/types';
@@ -17,6 +17,7 @@ export const readSavedQueryRoute = (router: IRouter) => {
validate: {
params: schema.object({}, { unknowns: 'allow' }),
},
+ options: { tags: [`access:${PLUGIN_ID}-readSavedQueries`] },
},
async (context, request, response) => {
const savedObjectsClient = context.core.savedObjects.client;
diff --git a/x-pack/plugins/osquery/server/routes/saved_query/update_saved_query_route.ts b/x-pack/plugins/osquery/server/routes/saved_query/update_saved_query_route.ts
index f9ecf675489dc..8edf95e311543 100644
--- a/x-pack/plugins/osquery/server/routes/saved_query/update_saved_query_route.ts
+++ b/x-pack/plugins/osquery/server/routes/saved_query/update_saved_query_route.ts
@@ -6,7 +6,7 @@
*/
import { schema } from '@kbn/config-schema';
-
+import { PLUGIN_ID } from '../../../common';
import { IRouter } from '../../../../../../src/core/server';
import { savedQuerySavedObjectType } from '../../../common/types';
@@ -18,6 +18,7 @@ export const updateSavedQueryRoute = (router: IRouter) => {
params: schema.object({}, { unknowns: 'allow' }),
body: schema.object({}, { unknowns: 'allow' }),
},
+ options: { tags: [`access:${PLUGIN_ID}-writeSavedQueries`] },
},
async (context, request, response) => {
const savedObjectsClient = context.core.savedObjects.client;
diff --git a/x-pack/plugins/osquery/server/routes/scheduled_query/create_scheduled_query_route.ts b/x-pack/plugins/osquery/server/routes/scheduled_query_group/create_scheduled_query_route.ts
similarity index 87%
rename from x-pack/plugins/osquery/server/routes/scheduled_query/create_scheduled_query_route.ts
rename to x-pack/plugins/osquery/server/routes/scheduled_query_group/create_scheduled_query_route.ts
index a3b882392989f..831fb30f6e320 100644
--- a/x-pack/plugins/osquery/server/routes/scheduled_query/create_scheduled_query_route.ts
+++ b/x-pack/plugins/osquery/server/routes/scheduled_query_group/create_scheduled_query_route.ts
@@ -6,16 +6,18 @@
*/
import { schema } from '@kbn/config-schema';
+import { PLUGIN_ID } from '../../../common';
import { IRouter } from '../../../../../../src/core/server';
import { OsqueryAppContext } from '../../lib/osquery_app_context_services';
export const createScheduledQueryRoute = (router: IRouter, osqueryContext: OsqueryAppContext) => {
router.post(
{
- path: '/internal/osquery/scheduled',
+ path: '/internal/osquery/scheduled_query_group',
validate: {
body: schema.object({}, { unknowns: 'allow' }),
},
+ options: { tags: [`access:${PLUGIN_ID}-writePacks`] },
},
async (context, request, response) => {
const esClient = context.core.elasticsearch.client.asCurrentUser;
diff --git a/x-pack/plugins/osquery/server/routes/scheduled_query/delete_scheduled_query_route.ts b/x-pack/plugins/osquery/server/routes/scheduled_query_group/delete_scheduled_query_route.ts
similarity index 87%
rename from x-pack/plugins/osquery/server/routes/scheduled_query/delete_scheduled_query_route.ts
rename to x-pack/plugins/osquery/server/routes/scheduled_query_group/delete_scheduled_query_route.ts
index 5b8e231ba61ec..c914512bb155e 100644
--- a/x-pack/plugins/osquery/server/routes/scheduled_query/delete_scheduled_query_route.ts
+++ b/x-pack/plugins/osquery/server/routes/scheduled_query_group/delete_scheduled_query_route.ts
@@ -6,17 +6,18 @@
*/
import { schema } from '@kbn/config-schema';
-
+import { PLUGIN_ID } from '../../../common';
import { IRouter } from '../../../../../../src/core/server';
import { savedQuerySavedObjectType } from '../../../common/types';
export const deleteSavedQueryRoute = (router: IRouter) => {
router.delete(
{
- path: '/internal/osquery/saved_query',
+ path: '/internal/osquery/scheduled_query_group',
validate: {
body: schema.object({}, { unknowns: 'allow' }),
},
+ options: { tags: [`access:${PLUGIN_ID}-writePacks`] },
},
async (context, request, response) => {
const savedObjectsClient = context.core.savedObjects.client;
diff --git a/x-pack/plugins/osquery/server/routes/scheduled_query_group/find_scheduled_query_group_route.ts b/x-pack/plugins/osquery/server/routes/scheduled_query_group/find_scheduled_query_group_route.ts
new file mode 100644
index 0000000000000..15c45e09b1bfd
--- /dev/null
+++ b/x-pack/plugins/osquery/server/routes/scheduled_query_group/find_scheduled_query_group_route.ts
@@ -0,0 +1,38 @@
+/*
+ * 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 { schema } from '@kbn/config-schema';
+import { PLUGIN_ID, OSQUERY_INTEGRATION_NAME } from '../../../common';
+import { IRouter } from '../../../../../../src/core/server';
+import { PACKAGE_POLICY_SAVED_OBJECT_TYPE } from '../../../../fleet/common';
+import { OsqueryAppContext } from '../../lib/osquery_app_context_services';
+
+export const findScheduledQueryGroupRoute = (
+ router: IRouter,
+ osqueryContext: OsqueryAppContext
+) => {
+ router.get(
+ {
+ path: '/internal/osquery/scheduled_query_group',
+ validate: {
+ query: schema.object({}, { unknowns: 'allow' }),
+ },
+ options: { tags: [`access:${PLUGIN_ID}-readPacks`] },
+ },
+ async (context, request, response) => {
+ const kuery = `${PACKAGE_POLICY_SAVED_OBJECT_TYPE}.attributes.package.name: ${OSQUERY_INTEGRATION_NAME}`;
+ const packagePolicyService = osqueryContext.service.getPackagePolicyService();
+ const policies = await packagePolicyService?.list(context.core.savedObjects.client, {
+ kuery,
+ });
+
+ return response.ok({
+ body: policies,
+ });
+ }
+ );
+};
diff --git a/x-pack/plugins/osquery/server/routes/scheduled_query/index.ts b/x-pack/plugins/osquery/server/routes/scheduled_query_group/index.ts
similarity index 67%
rename from x-pack/plugins/osquery/server/routes/scheduled_query/index.ts
rename to x-pack/plugins/osquery/server/routes/scheduled_query_group/index.ts
index 706bc38397296..416981a5cb5f2 100644
--- a/x-pack/plugins/osquery/server/routes/scheduled_query/index.ts
+++ b/x-pack/plugins/osquery/server/routes/scheduled_query_group/index.ts
@@ -10,14 +10,14 @@ import { IRouter } from '../../../../../../src/core/server';
import { OsqueryAppContext } from '../../lib/osquery_app_context_services';
// import { createScheduledQueryRoute } from './create_scheduled_query_route';
// import { deleteScheduledQueryRoute } from './delete_scheduled_query_route';
-import { findScheduledQueryRoute } from './find_scheduled_query_route';
-import { readScheduledQueryRoute } from './read_scheduled_query_route';
+import { findScheduledQueryGroupRoute } from './find_scheduled_query_group_route';
+import { readScheduledQueryGroupRoute } from './read_scheduled_query_group_route';
// import { updateScheduledQueryRoute } from './update_scheduled_query_route';
-export const initScheduledQueryRoutes = (router: IRouter, context: OsqueryAppContext) => {
+export const initScheduledQueryGroupRoutes = (router: IRouter, context: OsqueryAppContext) => {
// createScheduledQueryRoute(router);
// deleteScheduledQueryRoute(router);
- findScheduledQueryRoute(router, context);
- readScheduledQueryRoute(router, context);
+ findScheduledQueryGroupRoute(router, context);
+ readScheduledQueryGroupRoute(router, context);
// updateScheduledQueryRoute(router);
};
diff --git a/x-pack/plugins/osquery/server/routes/scheduled_query/read_scheduled_query_route.ts b/x-pack/plugins/osquery/server/routes/scheduled_query_group/read_scheduled_query_group_route.ts
similarity index 65%
rename from x-pack/plugins/osquery/server/routes/scheduled_query/read_scheduled_query_route.ts
rename to x-pack/plugins/osquery/server/routes/scheduled_query_group/read_scheduled_query_group_route.ts
index 009374f6a2e9e..de8125aab5b29 100644
--- a/x-pack/plugins/osquery/server/routes/scheduled_query/read_scheduled_query_route.ts
+++ b/x-pack/plugins/osquery/server/routes/scheduled_query_group/read_scheduled_query_group_route.ts
@@ -6,28 +6,34 @@
*/
import { schema } from '@kbn/config-schema';
-
+import { PLUGIN_ID } from '../../../common';
import { IRouter } from '../../../../../../src/core/server';
import { OsqueryAppContext } from '../../lib/osquery_app_context_services';
-export const readScheduledQueryRoute = (router: IRouter, osqueryContext: OsqueryAppContext) => {
+export const readScheduledQueryGroupRoute = (
+ router: IRouter,
+ osqueryContext: OsqueryAppContext
+) => {
router.get(
{
- path: '/internal/osquery/scheduled_query/{id}',
+ path: '/internal/osquery/scheduled_query_group/{id}',
validate: {
params: schema.object({}, { unknowns: 'allow' }),
},
+ options: { tags: [`access:${PLUGIN_ID}-readPacks`] },
},
async (context, request, response) => {
const savedObjectsClient = context.core.savedObjects.client;
const packagePolicyService = osqueryContext.service.getPackagePolicyService();
- // @ts-expect-error update types
- const scheduledQuery = await packagePolicyService?.get(savedObjectsClient, request.params.id);
+ const scheduledQueryGroup = await packagePolicyService?.get(
+ savedObjectsClient,
+ // @ts-expect-error update types
+ request.params.id
+ );
return response.ok({
- // @ts-expect-error update types
- body: scheduledQuery,
+ body: { item: scheduledQueryGroup },
});
}
);
diff --git a/x-pack/plugins/osquery/server/routes/scheduled_query/update_scheduled_query_route.ts b/x-pack/plugins/osquery/server/routes/scheduled_query_group/update_scheduled_query_route.ts
similarity index 92%
rename from x-pack/plugins/osquery/server/routes/scheduled_query/update_scheduled_query_route.ts
rename to x-pack/plugins/osquery/server/routes/scheduled_query_group/update_scheduled_query_route.ts
index efb4f2990e942..2a6e7a33fcddd 100644
--- a/x-pack/plugins/osquery/server/routes/scheduled_query/update_scheduled_query_route.ts
+++ b/x-pack/plugins/osquery/server/routes/scheduled_query_group/update_scheduled_query_route.ts
@@ -6,7 +6,7 @@
*/
import { schema } from '@kbn/config-schema';
-
+import { PLUGIN_ID } from '../../../common';
import { IRouter } from '../../../../../../src/core/server';
import { savedQuerySavedObjectType } from '../../../common/types';
@@ -18,6 +18,7 @@ export const updateSavedQueryRoute = (router: IRouter) => {
params: schema.object({}, { unknowns: 'allow' }),
body: schema.object({}, { unknowns: 'allow' }),
},
+ options: { tags: [`access:${PLUGIN_ID}-writePacks`] },
},
async (context, request, response) => {
const savedObjectsClient = context.core.savedObjects.client;
diff --git a/x-pack/plugins/osquery/server/routes/status/create_status_route.ts b/x-pack/plugins/osquery/server/routes/status/create_status_route.ts
index d7ea49c6152cd..0a527424f9f42 100644
--- a/x-pack/plugins/osquery/server/routes/status/create_status_route.ts
+++ b/x-pack/plugins/osquery/server/routes/status/create_status_route.ts
@@ -5,7 +5,7 @@
* 2.0.
*/
-import { OSQUERY_INTEGRATION_NAME } from '../../../common';
+import { PLUGIN_ID, OSQUERY_INTEGRATION_NAME } from '../../../common';
import { IRouter } from '../../../../../../src/core/server';
import { OsqueryAppContext } from '../../lib/osquery_app_context_services';
@@ -14,16 +14,10 @@ export const createStatusRoute = (router: IRouter, osqueryContext: OsqueryAppCon
{
path: '/internal/osquery/status',
validate: false,
+ options: { tags: [`access:${PLUGIN_ID}-read`] },
},
async (context, request, response) => {
const soClient = context.core.savedObjects.client;
- const isSuperUser = osqueryContext.security.authc
- .getCurrentUser(request)
- ?.roles.includes('superuser');
-
- if (!isSuperUser) {
- return response.ok({ body: undefined });
- }
const packageInfo = await osqueryContext.service
.getPackageService()
diff --git a/x-pack/plugins/osquery/server/routes/usage/saved_object_mappings.ts b/x-pack/plugins/osquery/server/routes/usage/saved_object_mappings.ts
index 92709f92d9e5f..603bcad87cf80 100644
--- a/x-pack/plugins/osquery/server/routes/usage/saved_object_mappings.ts
+++ b/x-pack/plugins/osquery/server/routes/usage/saved_object_mappings.ts
@@ -23,6 +23,6 @@ export const usageMetricSavedObjectMappings: SavedObjectsType['mappings'] = {
export const usageMetricType: SavedObjectsType = {
name: usageMetricSavedObjectType,
hidden: false,
- namespaceType: 'single',
+ namespaceType: 'agnostic',
mappings: usageMetricSavedObjectMappings,
};
diff --git a/x-pack/plugins/osquery/server/search_strategy/osquery/index.ts b/x-pack/plugins/osquery/server/search_strategy/osquery/index.ts
index 9fffb0726dce6..2fa9ee04ab534 100644
--- a/x-pack/plugins/osquery/server/search_strategy/osquery/index.ts
+++ b/x-pack/plugins/osquery/server/search_strategy/osquery/index.ts
@@ -23,7 +23,7 @@ import { OsqueryFactory } from './factory/types';
export const osquerySearchStrategyProvider = (
data: PluginStart
): ISearchStrategy, StrategyResponseType> => {
- const es = data.search.getSearchStrategy(ENHANCED_ES_SEARCH_STRATEGY);
+ let es: typeof data.search.searchAsInternalUser;
return {
search: (request, options, deps) => {
@@ -32,20 +32,35 @@ export const osquerySearchStrategyProvider = (
}
const queryFactory: OsqueryFactory = osqueryFactory[request.factoryQueryType];
const dsl = queryFactory.buildDsl(request);
- return es.search({ ...request, params: dsl }, options, deps).pipe(
- map((response) => {
- return {
- ...response,
- ...{
- rawResponse: shimHitsTotal(response.rawResponse),
- },
- };
- }),
- mergeMap((esSearchRes) => queryFactory.parse(request, esSearchRes))
- );
+
+ // use internal user for searching .fleet* indicies
+ es = dsl.index?.includes('fleet')
+ ? data.search.searchAsInternalUser
+ : data.search.getSearchStrategy(ENHANCED_ES_SEARCH_STRATEGY);
+
+ return es
+ .search(
+ {
+ ...request,
+ params: dsl,
+ },
+ options,
+ deps
+ )
+ .pipe(
+ map((response) => {
+ return {
+ ...response,
+ ...{
+ rawResponse: shimHitsTotal(response.rawResponse),
+ },
+ };
+ }),
+ mergeMap((esSearchRes) => queryFactory.parse(request, esSearchRes))
+ );
},
cancel: async (id, options, deps) => {
- if (es.cancel) {
+ if (es?.cancel) {
return es.cancel(id, options, deps);
}
},
diff --git a/x-pack/plugins/osquery/server/usage/collector.ts b/x-pack/plugins/osquery/server/usage/collector.ts
index 4432592a4e063..b04fc34e52453 100644
--- a/x-pack/plugins/osquery/server/usage/collector.ts
+++ b/x-pack/plugins/osquery/server/usage/collector.ts
@@ -11,11 +11,12 @@ import { getBeatUsage, getLiveQueryUsage, getPolicyLevelUsage } from './fetchers
import { CollectorDependencies, usageSchema, UsageData } from './types';
export type RegisterCollector = (deps: CollectorDependencies) => void;
-export async function getInternalSavedObjectsClient(core: CoreSetup) {
- return core.getStartServices().then(async ([coreStart]) => {
- return coreStart.savedObjects.createInternalRepository();
- });
-}
+export const getInternalSavedObjectsClient = async (
+ getStartServices: CoreSetup['getStartServices']
+) => {
+ const [coreStart] = await getStartServices();
+ return new SavedObjectsClient(coreStart.savedObjects.createInternalRepository());
+};
export const registerCollector: RegisterCollector = ({ core, osqueryContext, usageCollection }) => {
if (!usageCollection) {
@@ -26,7 +27,8 @@ export const registerCollector: RegisterCollector = ({ core, osqueryContext, usa
schema: usageSchema,
isReady: () => true,
fetch: async ({ esClient }: CollectorFetchContext): Promise => {
- const savedObjectsClient = new SavedObjectsClient(await getInternalSavedObjectsClient(core));
+ const savedObjectsClient = await getInternalSavedObjectsClient(core.getStartServices);
+
return {
beat_metrics: {
usage: await getBeatUsage(esClient),
diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json
index 1b20d91d480b2..c8e3526005963 100644
--- a/x-pack/plugins/translations/translations/ja-JP.json
+++ b/x-pack/plugins/translations/translations/ja-JP.json
@@ -1523,9 +1523,6 @@
"discover.doc.somethingWentWrongDescriptionAddon": "インデックスが存在することを確認してください。",
"discover.docTable.limitedSearchResultLabel": "{resultCount}件の結果のみが表示されます。検索結果を絞り込みます。",
"discover.docTable.noResultsTitle": "結果が見つかりませんでした",
- "discover.docTable.pager.toolbarPagerButtons.nextButtonAriaLabel": "表内の次ページ",
- "discover.docTable.pager.toolbarPagerButtons.previousButtonAriaLabel": "表内の前ページ",
- "discover.docTable.pagerControl.pagesCountLabel": "{startItem}–{endItem}/{totalItems}",
"discover.docTable.tableHeader.documentHeader": "ドキュメント",
"discover.docTable.tableHeader.moveColumnLeftButtonAriaLabel": "{columnName}列を左に移動",
"discover.docTable.tableHeader.moveColumnLeftButtonTooltip": "列を左に移動",
@@ -18517,10 +18514,20 @@
"xpack.observability.expView.operationType.99thPercentile": "99パーセンタイル",
"xpack.observability.expView.operationType.average": "平均",
"xpack.observability.expView.operationType.median": "中央",
+ "xpack.observability.expView.reportType.noDataType": "データ型を選択すると、系列の構築を開始します。",
+ "xpack.observability.expView.seriesBuilder.breakdown": "内訳",
+ "xpack.observability.expView.seriesBuilder.dataType": "データ型",
+ "xpack.observability.expView.seriesBuilder.definition": "定義",
+ "xpack.observability.expView.seriesBuilder.filters": "フィルター",
+ "xpack.observability.expView.seriesBuilder.report": "レポート",
"xpack.observability.expView.seriesBuilder.selectReportType": "レポートタイプを選択すると、ビジュアライゼーションを定義します。",
+ "xpack.observability.expView.seriesEditor.actions": "アクション",
+ "xpack.observability.expView.seriesEditor.addFilter": "フィルターを追加します",
+ "xpack.observability.expView.seriesEditor.breakdowns": "内訳",
"xpack.observability.expView.seriesEditor.clearFilter": "フィルターを消去",
"xpack.observability.expView.seriesEditor.filters": "フィルター",
"xpack.observability.expView.seriesEditor.name": "名前",
+ "xpack.observability.expView.seriesEditor.removeSeries": "クリックすると、系列を削除します",
"xpack.observability.expView.seriesEditor.time": "時間",
"xpack.observability.featureCatalogueDescription": "専用UIで、ログ、メトリック、アプリケーショントレース、システム可用性を連結します。",
"xpack.observability.featureCatalogueDescription1": "インフラストラクチャメトリックを監視します。",
@@ -18586,6 +18593,7 @@
"xpack.observability.overview.uptime.up": "アップ",
"xpack.observability.overview.ux.appLink": "アプリで表示",
"xpack.observability.overview.ux.title": "ユーザーエクスペリエンス",
+ "xpack.observability.reportTypeCol.nodata": "利用可能なデータがありません",
"xpack.observability.resources.documentation": "ドキュメント",
"xpack.observability.resources.forum": "ディスカッションフォーラム",
"xpack.observability.resources.title": "リソース",
@@ -18599,6 +18607,7 @@
"xpack.observability.section.apps.uptime.description": "サイトとサービスの可用性をアクティブに監視するアラートを受信し、問題をより迅速に解決して、ユーザーエクスペリエンスを最適化します。",
"xpack.observability.section.apps.uptime.title": "アップタイム",
"xpack.observability.section.errorPanel": "データの取得時にエラーが発生しました。再試行してください",
+ "xpack.observability.seriesEditor.edit": "系列を編集",
"xpack.observability.transactionRateLabel": "{value} tpm",
"xpack.observability.ux.coreVitals.average": "平均",
"xpack.observability.ux.coreVitals.averageMessage": " {bad}未満",
diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json
index d3c89b74eca8b..cf31ec8d8eceb 100644
--- a/x-pack/plugins/translations/translations/zh-CN.json
+++ b/x-pack/plugins/translations/translations/zh-CN.json
@@ -1532,9 +1532,6 @@
"discover.doc.somethingWentWrongDescriptionAddon": "请确保索引存在。",
"discover.docTable.limitedSearchResultLabel": "仅限于 {resultCount} 个结果。优化您的搜索。",
"discover.docTable.noResultsTitle": "找不到结果",
- "discover.docTable.pager.toolbarPagerButtons.nextButtonAriaLabel": "表中下一页",
- "discover.docTable.pager.toolbarPagerButtons.previousButtonAriaLabel": "表中上一页",
- "discover.docTable.pagerControl.pagesCountLabel": "{startItem}–{endItem}/{totalItems}",
"discover.docTable.tableHeader.documentHeader": "文档",
"discover.docTable.tableHeader.moveColumnLeftButtonAriaLabel": "向左移动“{columnName}”列",
"discover.docTable.tableHeader.moveColumnLeftButtonTooltip": "向左移动列",
@@ -18933,10 +18930,20 @@
"xpack.observability.expView.operationType.99thPercentile": "第 99 个百分位",
"xpack.observability.expView.operationType.average": "平均值",
"xpack.observability.expView.operationType.median": "中值",
+ "xpack.observability.expView.reportType.noDataType": "选择数据类型以开始构建序列。",
+ "xpack.observability.expView.seriesBuilder.breakdown": "分解",
+ "xpack.observability.expView.seriesBuilder.dataType": "数据类型",
+ "xpack.observability.expView.seriesBuilder.definition": "定义",
+ "xpack.observability.expView.seriesBuilder.filters": "筛选",
+ "xpack.observability.expView.seriesBuilder.report": "报告",
"xpack.observability.expView.seriesBuilder.selectReportType": "选择报告类型以定义可视化。",
+ "xpack.observability.expView.seriesEditor.actions": "操作",
+ "xpack.observability.expView.seriesEditor.addFilter": "添加筛选",
+ "xpack.observability.expView.seriesEditor.breakdowns": "分解",
"xpack.observability.expView.seriesEditor.clearFilter": "清除筛选",
"xpack.observability.expView.seriesEditor.filters": "筛选",
"xpack.observability.expView.seriesEditor.name": "名称",
+ "xpack.observability.expView.seriesEditor.removeSeries": "单击移除序列",
"xpack.observability.expView.seriesEditor.time": "时间",
"xpack.observability.featureCatalogueDescription": "通过专用 UI 整合您的日志、指标、应用程序跟踪和系统可用性。",
"xpack.observability.featureCatalogueDescription1": "监测基础架构指标。",
@@ -19002,6 +19009,7 @@
"xpack.observability.overview.uptime.up": "运行",
"xpack.observability.overview.ux.appLink": "在应用中查看",
"xpack.observability.overview.ux.title": "用户体验",
+ "xpack.observability.reportTypeCol.nodata": "没有可用数据",
"xpack.observability.resources.documentation": "文档",
"xpack.observability.resources.forum": "讨论论坛",
"xpack.observability.resources.title": "资源",
@@ -19015,6 +19023,7 @@
"xpack.observability.section.apps.uptime.description": "主动监测站点和服务的可用性。接收告警并更快地解决问题,从而优化用户体验。",
"xpack.observability.section.apps.uptime.title": "运行时间",
"xpack.observability.section.errorPanel": "尝试提取数据时发生错误。请重试",
+ "xpack.observability.seriesEditor.edit": "编辑序列",
"xpack.observability.transactionRateLabel": "{value} tpm",
"xpack.observability.ux.coreVitals.average": "平均值",
"xpack.observability.ux.coreVitals.averageMessage": " 且小于 {bad}",
diff --git a/x-pack/plugins/uptime/public/components/common/charts/ping_histogram.tsx b/x-pack/plugins/uptime/public/components/common/charts/ping_histogram.tsx
index aa981071b7ee2..1a53a2c9b64a0 100644
--- a/x-pack/plugins/uptime/public/components/common/charts/ping_histogram.tsx
+++ b/x-pack/plugins/uptime/public/components/common/charts/ping_histogram.tsx
@@ -22,7 +22,6 @@ import React, { useContext } from 'react';
import { FormattedMessage } from '@kbn/i18n/react';
import numeral from '@elastic/numeral';
import moment from 'moment';
-import { useSelector } from 'react-redux';
import { getChartDateLabel } from '../../../lib/helper';
import { ChartWrapper } from './chart_wrapper';
import { UptimeThemeContext } from '../../../contexts';
@@ -33,7 +32,6 @@ import { getDateRangeFromChartElement } from './utils';
import { STATUS_DOWN_LABEL, STATUS_UP_LABEL } from '../translations';
import { createExploratoryViewUrl } from '../../../../../observability/public';
import { useUptimeSettingsContext } from '../../../contexts/uptime_settings_context';
-import { monitorStatusSelector } from '../../../state/selectors';
export interface PingHistogramComponentProps {
/**
@@ -75,8 +73,6 @@ export const PingHistogramComponent: React.FC = ({
const monitorId = useMonitorId();
- const selectedMonitor = useSelector(monitorStatusSelector);
-
const { basePath } = useUptimeSettingsContext();
const [getUrlParams, updateUrlParams] = useUrlParams();
@@ -193,21 +189,12 @@ export const PingHistogramComponent: React.FC = ({
const pingHistogramExploratoryViewLink = createExploratoryViewUrl(
{
- reportType: 'kpi-over-time',
- allSeries: [
- {
- name: `${monitorId}-pings`,
- dataType: 'synthetics',
- selectedMetricField: 'summary.up',
- time: { from: dateRangeStart, to: dateRangeEnd },
- reportDefinitions: {
- 'monitor.name':
- monitorId && selectedMonitor?.monitor?.name
- ? [selectedMonitor.monitor.name]
- : ['ALL_VALUES'],
- },
- },
- ],
+ 'pings-over-time': {
+ dataType: 'synthetics',
+ reportType: 'kpi-over-time',
+ time: { from: dateRangeStart, to: dateRangeEnd },
+ ...(monitorId ? { filters: [{ field: 'monitor.id', values: [monitorId] }] } : {}),
+ },
},
basePath
);
diff --git a/x-pack/plugins/uptime/public/components/common/header/action_menu_content.tsx b/x-pack/plugins/uptime/public/components/common/header/action_menu_content.tsx
index c459fe46da975..9f00dd2e8f061 100644
--- a/x-pack/plugins/uptime/public/components/common/header/action_menu_content.tsx
+++ b/x-pack/plugins/uptime/public/components/common/header/action_menu_content.tsx
@@ -10,15 +10,13 @@ import { EuiHeaderLinks, EuiToolTip, EuiHeaderLink } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import { useHistory } from 'react-router-dom';
-import { useSelector } from 'react-redux';
-import { createExploratoryViewUrl } from '../../../../../observability/public';
+import { createExploratoryViewUrl, SeriesUrl } from '../../../../../observability/public';
import { useKibana } from '../../../../../../../src/plugins/kibana_react/public';
import { useUptimeSettingsContext } from '../../../contexts/uptime_settings_context';
import { useGetUrlParams } from '../../../hooks';
import { ToggleAlertFlyoutButton } from '../../overview/alerts/alerts_containers';
import { SETTINGS_ROUTE } from '../../../../common/constants';
import { stringifyUrlParams } from '../../../lib/helper/stringify_url_params';
-import { monitorStatusSelector } from '../../../state/selectors';
const ADD_DATA_LABEL = i18n.translate('xpack.uptime.addDataButtonLabel', {
defaultMessage: 'Add data',
@@ -40,28 +38,13 @@ export function ActionMenuContent(): React.ReactElement {
const { dateRangeStart, dateRangeEnd } = params;
const history = useHistory();
- const selectedMonitor = useSelector(monitorStatusSelector);
-
- const monitorId = selectedMonitor?.monitor?.id;
-
const syntheticExploratoryViewLink = createExploratoryViewUrl(
{
- reportType: 'kpi-over-time',
- allSeries: [
- {
- dataType: 'synthetics',
- seriesType: 'area_stacked',
- selectedMetricField: 'monitor.duration.us',
- time: { from: dateRangeStart, to: dateRangeEnd },
- breakdown: monitorId ? 'observer.geo.name' : 'monitor.type',
- reportDefinitions: {
- 'monitor.name': selectedMonitor?.monitor?.name
- ? [selectedMonitor?.monitor?.name]
- : ['ALL_VALUES'],
- },
- name: monitorId ? `${monitorId}-response-duration` : 'All monitors response duration',
- },
- ],
+ 'synthetics-series': ({
+ dataType: 'synthetics',
+ isNew: true,
+ time: { from: dateRangeStart, to: dateRangeEnd },
+ } as unknown) as SeriesUrl,
},
basePath
);
diff --git a/x-pack/plugins/uptime/public/components/monitor/monitor_duration/monitor_duration_container.tsx b/x-pack/plugins/uptime/public/components/monitor/monitor_duration/monitor_duration_container.tsx
index 18aba948eaa37..1590e225f9ca8 100644
--- a/x-pack/plugins/uptime/public/components/monitor/monitor_duration/monitor_duration_container.tsx
+++ b/x-pack/plugins/uptime/public/components/monitor/monitor_duration/monitor_duration_container.tsx
@@ -55,19 +55,16 @@ export const MonitorDuration: React.FC = ({ monitorId }) => {
const exploratoryViewLink = createExploratoryViewUrl(
{
- reportType: 'kpi-over-time',
- allSeries: [
- {
- name: `${monitorId}-response-duration`,
- time: { from: dateRangeStart, to: dateRangeEnd },
- reportDefinitions: {
- 'monitor.id': [monitorId] as string[],
- },
- breakdown: 'observer.geo.name',
- operationType: 'average',
- dataType: 'synthetics',
+ [`monitor-duration`]: {
+ reportType: 'kpi-over-time',
+ time: { from: dateRangeStart, to: dateRangeEnd },
+ reportDefinitions: {
+ 'monitor.id': [monitorId] as string[],
},
- ],
+ breakdown: 'observer.geo.name',
+ operationType: 'average',
+ dataType: 'synthetics',
+ },
},
basePath
);
diff --git a/x-pack/test/api_integration/apis/features/features/features.ts b/x-pack/test/api_integration/apis/features/features/features.ts
index 275626664bef0..6a6a0e13a1e1e 100644
--- a/x-pack/test/api_integration/apis/features/features/features.ts
+++ b/x-pack/test/api_integration/apis/features/features/features.ts
@@ -115,6 +115,7 @@ export default function ({ getService }: FtrProviderContext) {
'logs',
'maps',
'observabilityCases',
+ 'osquery',
'uptime',
'siem',
'fleet',
diff --git a/x-pack/test/api_integration/apis/security/privileges.ts b/x-pack/test/api_integration/apis/security/privileges.ts
index 2576a5eaf9bc9..bbb0fc60cb3ce 100644
--- a/x-pack/test/api_integration/apis/security/privileges.ts
+++ b/x-pack/test/api_integration/apis/security/privileges.ts
@@ -70,6 +70,19 @@ export default function ({ getService }: FtrProviderContext) {
indexPatterns: ['all', 'read'],
savedObjectsManagement: ['all', 'read'],
timelion: ['all', 'read'],
+ osquery: [
+ 'all',
+ 'read',
+ 'minimal_all',
+ 'minimal_read',
+ 'live_queries_all',
+ 'live_queries_read',
+ 'run_saved_queries',
+ 'saved_queries_all',
+ 'saved_queries_read',
+ 'packs_all',
+ 'packs_read',
+ ],
},
reserved: ['ml_user', 'ml_admin', 'ml_apm_user', 'monitoring'],
};
diff --git a/x-pack/test/api_integration/apis/security/privileges_basic.ts b/x-pack/test/api_integration/apis/security/privileges_basic.ts
index 25266da2cdfb3..dc00be028412b 100644
--- a/x-pack/test/api_integration/apis/security/privileges_basic.ts
+++ b/x-pack/test/api_integration/apis/security/privileges_basic.ts
@@ -37,6 +37,7 @@ export default function ({ getService }: FtrProviderContext) {
logs: ['all', 'read'],
uptime: ['all', 'read'],
apm: ['all', 'read'],
+ osquery: ['all', 'read'],
ml: ['all', 'read'],
siem: ['all', 'read'],
fleet: ['all', 'read'],
diff --git a/x-pack/test/fleet_api_integration/apis/epm/final_pipeline.ts b/x-pack/test/fleet_api_integration/apis/epm/final_pipeline.ts
index 073d08c5b1d8d..8c6603a3e38b0 100644
--- a/x-pack/test/fleet_api_integration/apis/epm/final_pipeline.ts
+++ b/x-pack/test/fleet_api_integration/apis/epm/final_pipeline.ts
@@ -14,6 +14,8 @@ const TEST_INDEX = 'logs-log.log-test';
const FINAL_PIPELINE_ID = '.fleet_final_pipeline-1';
+const FINAL_PIPELINE_VERSION = 1;
+
let pkgKey: string;
export default function (providerContext: FtrProviderContext) {
@@ -81,11 +83,32 @@ export default function (providerContext: FtrProviderContext) {
}
});
+ it('should correctly update the final pipeline', async () => {
+ await es.ingest.putPipeline({
+ id: FINAL_PIPELINE_ID,
+ body: {
+ description: 'Test PIPELINE WITHOUT version',
+ processors: [
+ {
+ set: {
+ field: 'my-keyword-field',
+ value: 'foo',
+ },
+ },
+ ],
+ },
+ });
+ await supertest.post(`/api/fleet/setup`).set('kbn-xsrf', 'xxxx');
+ const pipelineRes = await es.ingest.getPipeline({ id: FINAL_PIPELINE_ID });
+ expect(pipelineRes.body).to.have.property(FINAL_PIPELINE_ID);
+ expect(pipelineRes.body[FINAL_PIPELINE_ID].version).to.be(1);
+ });
+
it('should correctly setup the final pipeline and apply to fleet managed index template', async () => {
const pipelineRes = await es.ingest.getPipeline({ id: FINAL_PIPELINE_ID });
expect(pipelineRes.body).to.have.property(FINAL_PIPELINE_ID);
const res = await es.indices.getIndexTemplate({ name: 'logs-log.log' });
- expect(res.body.index_templates.length).to.be(1);
+ expect(res.body.index_templates.length).to.be(FINAL_PIPELINE_VERSION);
expect(res.body.index_templates[0]?.index_template?.composed_of).to.contain(
'.fleet_component_template-1'
);
diff --git a/x-pack/test/functional/apps/discover/feature_controls/discover_spaces.ts b/x-pack/test/functional/apps/discover/feature_controls/discover_spaces.ts
index c05b15905b932..3542abf9ea863 100644
--- a/x-pack/test/functional/apps/discover/feature_controls/discover_spaces.ts
+++ b/x-pack/test/functional/apps/discover/feature_controls/discover_spaces.ts
@@ -22,6 +22,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
]);
const testSubjects = getService('testSubjects');
const appsMenu = getService('appsMenu');
+ const kibanaServer = getService('kibanaServer');
async function setDiscoverTimeRange() {
await PageObjects.timePicker.setDefaultAbsoluteRange();
@@ -36,8 +37,12 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
before(async () => {
// we need to load the following in every situation as deleting
// a space deletes all of the associated saved objects
- await esArchiver.load(
- 'x-pack/test/functional/es_archives/discover/feature_controls/spaces'
+ await kibanaServer.importExport.load(
+ 'x-pack/test/functional/fixtures/kbn_archiver/discover/feature_controls/spaces'
+ );
+ await kibanaServer.importExport.load(
+ 'x-pack/test/functional/fixtures/kbn_archiver/discover/feature_controls/custom_space',
+ { space: 'custom_space' }
);
await spacesService.create({
id: 'custom_space',
@@ -48,8 +53,12 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
after(async () => {
await spacesService.delete('custom_space');
- await esArchiver.unload(
- 'x-pack/test/functional/es_archives/discover/feature_controls/spaces'
+ await kibanaServer.importExport.unload(
+ 'x-pack/test/functional/fixtures/kbn_archiver/discover/feature_controls/custom_space',
+ { space: 'custom_space' }
+ );
+ await kibanaServer.importExport.unload(
+ 'x-pack/test/functional/fixtures/kbn_archiver/discover/feature_controls/spaces'
);
});
@@ -84,8 +93,8 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
before(async () => {
// we need to load the following in every situation as deleting
// a space deletes all of the associated saved objects
- await esArchiver.load(
- 'x-pack/test/functional/es_archives/discover/feature_controls/spaces'
+ await kibanaServer.importExport.load(
+ 'x-pack/test/functional/fixtures/kbn_archiver/discover/feature_controls/spaces'
);
await spacesService.create({
id: 'custom_space',
@@ -96,8 +105,8 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
after(async () => {
await spacesService.delete('custom_space');
- await esArchiver.unload(
- 'x-pack/test/functional/es_archives/discover/feature_controls/spaces'
+ await kibanaServer.importExport.unload(
+ 'x-pack/test/functional/fixtures/kbn_archiver/discover/feature_controls/spaces'
);
});
diff --git a/x-pack/test/functional/apps/observability/exploratory_view.ts b/x-pack/test/functional/apps/observability/exploratory_view.ts
deleted file mode 100644
index 8f27f20ce30e6..0000000000000
--- a/x-pack/test/functional/apps/observability/exploratory_view.ts
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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 Path from 'path';
-import expect from '@kbn/expect';
-import { FtrProviderContext } from '../../ftr_provider_context';
-
-export default function ({ getService, getPageObjects }: FtrProviderContext) {
- const PageObjects = getPageObjects(['observability', 'common', 'header']);
- const esArchiver = getService('esArchiver');
- const find = getService('find');
-
- const testSubjects = getService('testSubjects');
-
- const rangeFrom = '2021-01-17T16%3A46%3A15.338Z';
- const rangeTo = '2021-01-19T17%3A01%3A32.309Z';
-
- // Failing: See https://github.com/elastic/kibana/issues/106934
- describe.skip('ExploratoryView', () => {
- before(async () => {
- await esArchiver.loadIfNeeded(
- Path.join('x-pack/test/apm_api_integration/common/fixtures/es_archiver', '8.0.0')
- );
-
- await esArchiver.loadIfNeeded(
- Path.join('x-pack/test/apm_api_integration/common/fixtures/es_archiver', 'rum_8.0.0')
- );
-
- await esArchiver.loadIfNeeded(
- Path.join('x-pack/test/apm_api_integration/common/fixtures/es_archiver', 'rum_test_data')
- );
-
- await PageObjects.common.navigateToApp('ux', {
- search: `?rangeFrom=${rangeFrom}&rangeTo=${rangeTo}`,
- });
- await PageObjects.header.waitUntilLoadingHasFinished();
- });
-
- after(async () => {
- await esArchiver.unload(
- Path.join('x-pack/test/apm_api_integration/common/fixtures/es_archiver', '8.0.0')
- );
-
- await esArchiver.unload(
- Path.join('x-pack/test/apm_api_integration/common/fixtures/es_archiver', 'rum_8.0.0')
- );
- });
-
- it('should able to open exploratory view from ux app', async () => {
- await testSubjects.exists('uxAnalyzeBtn');
- await testSubjects.click('uxAnalyzeBtn');
- expect(await find.existsByCssSelector('.euiBasicTable')).to.eql(true);
- });
-
- it('renders lens visualization', async () => {
- expect(await testSubjects.exists('lnsVisualizationContainer')).to.eql(true);
-
- expect(
- await find.existsByCssSelector('div[data-title="Prefilled from exploratory view app"]')
- ).to.eql(true);
-
- expect((await find.byCssSelector('dd')).getVisibleText()).to.eql(true);
- });
-
- it('can do a breakdown per series', async () => {
- await testSubjects.click('seriesBreakdown');
-
- expect(await find.existsByCssSelector('[id="user_agent.name"]')).to.eql(true);
-
- await find.clickByCssSelector('[id="user_agent.name"]');
-
- await PageObjects.header.waitUntilLoadingHasFinished();
-
- expect(await find.existsByCssSelector('[title="Chrome Mobile iOS"]')).to.eql(true);
- expect(await find.existsByCssSelector('[title="Mobile Safari"]')).to.eql(true);
- });
- });
-}
diff --git a/x-pack/test/functional/apps/observability/index.ts b/x-pack/test/functional/apps/observability/index.ts
index cce07b9ff7d86..b7f03b5f27bae 100644
--- a/x-pack/test/functional/apps/observability/index.ts
+++ b/x-pack/test/functional/apps/observability/index.ts
@@ -8,9 +8,8 @@
import { FtrProviderContext } from '../../ftr_provider_context';
export default function ({ loadTestFile }: FtrProviderContext) {
- describe('ObservabilityApp', function () {
+ describe('Observability specs', function () {
this.tags('ciGroup6');
loadTestFile(require.resolve('./feature_controls'));
- loadTestFile(require.resolve('./exploratory_view'));
});
}
diff --git a/x-pack/test/functional/es_archives/discover/feature_controls/spaces/data.json b/x-pack/test/functional/es_archives/discover/feature_controls/spaces/data.json
deleted file mode 100644
index af5aa6d043484..0000000000000
--- a/x-pack/test/functional/es_archives/discover/feature_controls/spaces/data.json
+++ /dev/null
@@ -1,77 +0,0 @@
-{
- "type": "doc",
- "value": {
- "index": ".kibana",
- "type": "doc",
- "id": "index-pattern:logstash-*",
- "source": {
- "index-pattern": {
- "title": "logstash-*",
- "timeFieldName": "@timestamp",
- "fields": "[{\"name\":\"@message\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@message.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"@tags\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@tags.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"@timestamp\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"_id\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_score\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_source\",\"type\":\"_source\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"agent\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"agent.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"bytes\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"clientip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"extension\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"extension.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.coordinates\",\"type\":\"geo_point\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.dest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.src\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.srcdest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"headings\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"headings.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"host.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"id\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"index.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"ip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"links\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"links.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"machine.os\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"machine.os.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"machine.ram\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"memory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.char\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.related\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.firstname\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.lastname\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"phpmemory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"referer\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:modified_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:published_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:section\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:section.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:tag\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:tag.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image:height\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:height.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image:width\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:width.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:site_name\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:site_name.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:type.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:card\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:card.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:site\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:site.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"request\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"request.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"response\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"response.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"spaces\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"spaces.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"utc_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"xss\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"xss.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true}]"
- },
- "type": "index-pattern",
- "migrationVersion": {
- "index-pattern": "6.5.0"
- },
- "updated_at": "2018-12-21T00:43:07.096Z"
- }
- }
-}
-
-{
- "type": "doc",
- "value": {
- "index": ".kibana",
- "type": "doc",
- "id": "config:6.0.0",
- "source": {
- "config": {
- "buildNum": 9007199254740991,
- "defaultIndex": "logstash-*"
- },
- "type": "config",
- "updated_at": "2019-01-22T19:32:02.235Z"
- }
- }
-}
-
-{
- "type": "doc",
- "value": {
- "index": ".kibana",
- "type": "doc",
- "id": "custom_space:index-pattern:logstash-*",
- "source": {
- "namespace": "custom_space",
- "index-pattern": {
- "title": "logstash-*",
- "timeFieldName": "@timestamp",
- "fields": "[{\"name\":\"@message\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@message.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"@tags\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@tags.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"@timestamp\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"_id\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_score\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_source\",\"type\":\"_source\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"agent\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"agent.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"bytes\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"clientip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"extension\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"extension.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.coordinates\",\"type\":\"geo_point\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.dest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.src\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.srcdest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"headings\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"headings.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"host.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"id\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"index.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"ip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"links\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"links.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"machine.os\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"machine.os.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"machine.ram\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"memory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.char\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.related\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.firstname\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.lastname\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"phpmemory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"referer\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:modified_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:published_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:section\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:section.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:tag\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:tag.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image:height\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:height.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image:width\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:width.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:site_name\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:site_name.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:type.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:card\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:card.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:site\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:site.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"request\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"request.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"response\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"response.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"spaces\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"spaces.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"utc_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"xss\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"xss.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true}]"
- },
- "type": "index-pattern",
- "migrationVersion": {
- "index-pattern": "6.5.0"
- },
- "updated_at": "2018-12-21T00:43:07.096Z"
- }
- }
-}
-
-{
- "type": "doc",
- "value": {
- "index": ".kibana",
- "type": "doc",
- "id": "custom_space:config:6.0.0",
- "source": {
- "namespace": "custom_space",
- "config": {
- "buildNum": 9007199254740991,
- "defaultIndex": "logstash-*"
- },
- "type": "config",
- "updated_at": "2019-01-22T19:32:02.235Z"
- }
- }
-}
diff --git a/x-pack/test/functional/es_archives/discover/feature_controls/spaces/mappings.json b/x-pack/test/functional/es_archives/discover/feature_controls/spaces/mappings.json
deleted file mode 100644
index 0cd1a29f92241..0000000000000
--- a/x-pack/test/functional/es_archives/discover/feature_controls/spaces/mappings.json
+++ /dev/null
@@ -1,462 +0,0 @@
-{
- "type": "index",
- "value": {
- "aliases": {
- ".kibana": {}
- },
- "index": ".kibana_1",
- "settings": {
- "index": {
- "number_of_shards": "1",
- "auto_expand_replicas": "0-1",
- "number_of_replicas": "0"
- }
- },
- "mappings": {
- "dynamic": "strict",
- "properties": {
- "apm-telemetry": {
- "properties": {
- "has_any_services": {
- "type": "boolean"
- },
- "services_per_agent": {
- "properties": {
- "go": {
- "type": "long",
- "null_value": 0
- },
- "java": {
- "type": "long",
- "null_value": 0
- },
- "js-base": {
- "type": "long",
- "null_value": 0
- },
- "nodejs": {
- "type": "long",
- "null_value": 0
- },
- "python": {
- "type": "long",
- "null_value": 0
- },
- "ruby": {
- "type": "long",
- "null_value": 0
- }
- }
- }
- }
- },
- "canvas-workpad": {
- "dynamic": "false",
- "properties": {
- "@created": {
- "type": "date"
- },
- "@timestamp": {
- "type": "date"
- },
- "id": {
- "type": "text",
- "index": false
- },
- "name": {
- "type": "text",
- "fields": {
- "keyword": {
- "type": "keyword"
- }
- }
- }
- }
- },
- "config": {
- "dynamic": "true",
- "properties": {
- "accessibility:disableAnimations": {
- "type": "boolean"
- },
- "buildNum": {
- "type": "keyword"
- },
- "dateFormat:tz": {
- "type": "text",
- "fields": {
- "keyword": {
- "type": "keyword",
- "ignore_above": 256
- }
- }
- },
- "defaultIndex": {
- "type": "text",
- "fields": {
- "keyword": {
- "type": "keyword",
- "ignore_above": 256
- }
- }
- },
- "telemetry:optIn": {
- "type": "boolean"
- }
- }
- },
- "dashboard": {
- "properties": {
- "description": {
- "type": "text"
- },
- "hits": {
- "type": "integer"
- },
- "kibanaSavedObjectMeta": {
- "properties": {
- "searchSourceJSON": {
- "type": "text"
- }
- }
- },
- "optionsJSON": {
- "type": "text"
- },
- "panelsJSON": {
- "type": "text"
- },
- "refreshInterval": {
- "properties": {
- "display": {
- "type": "keyword"
- },
- "pause": {
- "type": "boolean"
- },
- "section": {
- "type": "integer"
- },
- "value": {
- "type": "integer"
- }
- }
- },
- "timeFrom": {
- "type": "keyword"
- },
- "timeRestore": {
- "type": "boolean"
- },
- "timeTo": {
- "type": "keyword"
- },
- "title": {
- "type": "text"
- },
- "uiStateJSON": {
- "type": "text"
- },
- "version": {
- "type": "integer"
- }
- }
- },
- "gis-map" : {
- "properties" : {
- "bounds": {
- "dynamic": false,
- "properties": {}
- },
- "description" : {
- "type" : "text"
- },
- "layerListJSON" : {
- "type" : "text"
- },
- "mapStateJSON" : {
- "type" : "text"
- },
- "title" : {
- "type" : "text"
- },
- "uiStateJSON" : {
- "type" : "text"
- },
- "version" : {
- "type" : "integer"
- }
- }
- },
- "graph-workspace": {
- "properties": {
- "description": {
- "type": "text"
- },
- "kibanaSavedObjectMeta": {
- "properties": {
- "searchSourceJSON": {
- "type": "text"
- }
- }
- },
- "numLinks": {
- "type": "integer"
- },
- "numVertices": {
- "type": "integer"
- },
- "title": {
- "type": "text"
- },
- "version": {
- "type": "integer"
- },
- "wsState": {
- "type": "text"
- }
- }
- },
- "index-pattern": {
- "properties": {
- "fieldFormatMap": {
- "type": "text"
- },
- "fields": {
- "type": "text"
- },
- "intervalName": {
- "type": "keyword"
- },
- "notExpandable": {
- "type": "boolean"
- },
- "sourceFilters": {
- "type": "text"
- },
- "timeFieldName": {
- "type": "keyword"
- },
- "title": {
- "type": "text"
- },
- "type": {
- "type": "keyword"
- },
- "typeMeta": {
- "type": "keyword"
- }
- }
- },
- "kql-telemetry": {
- "properties": {
- "optInCount": {
- "type": "long"
- },
- "optOutCount": {
- "type": "long"
- }
- }
- },
- "migrationVersion": {
- "dynamic": "true",
- "properties": {
- "index-pattern": {
- "type": "text",
- "fields": {
- "keyword": {
- "type": "keyword",
- "ignore_above": 256
- }
- }
- },
- "space": {
- "type": "text",
- "fields": {
- "keyword": {
- "type": "keyword",
- "ignore_above": 256
- }
- }
- }
- }
- },
- "namespace": {
- "type": "keyword"
- },
- "search": {
- "properties": {
- "columns": {
- "type": "keyword"
- },
- "description": {
- "type": "text"
- },
- "hits": {
- "type": "integer"
- },
- "kibanaSavedObjectMeta": {
- "properties": {
- "searchSourceJSON": {
- "type": "text"
- }
- }
- },
- "sort": {
- "type": "keyword"
- },
- "title": {
- "type": "text"
- },
- "version": {
- "type": "integer"
- }
- }
- },
- "server": {
- "properties": {
- "uuid": {
- "type": "keyword"
- }
- }
- },
- "space": {
- "properties": {
- "_reserved": {
- "type": "boolean"
- },
- "color": {
- "type": "keyword"
- },
- "description": {
- "type": "text"
- },
- "disabledFeatures": {
- "type": "keyword"
- },
- "initials": {
- "type": "keyword"
- },
- "name": {
- "type": "text",
- "fields": {
- "keyword": {
- "type": "keyword",
- "ignore_above": 2048
- }
- }
- }
- }
- },
- "spaceId": {
- "type": "keyword"
- },
- "telemetry": {
- "properties": {
- "enabled": {
- "type": "boolean"
- }
- }
- },
- "timelion-sheet": {
- "properties": {
- "description": {
- "type": "text"
- },
- "hits": {
- "type": "integer"
- },
- "kibanaSavedObjectMeta": {
- "properties": {
- "searchSourceJSON": {
- "type": "text"
- }
- }
- },
- "timelion_chart_height": {
- "type": "integer"
- },
- "timelion_columns": {
- "type": "integer"
- },
- "timelion_interval": {
- "type": "keyword"
- },
- "timelion_other_interval": {
- "type": "keyword"
- },
- "timelion_rows": {
- "type": "integer"
- },
- "timelion_sheet": {
- "type": "text"
- },
- "title": {
- "type": "text"
- },
- "version": {
- "type": "integer"
- }
- }
- },
- "type": {
- "type": "keyword"
- },
- "updated_at": {
- "type": "date"
- },
- "url": {
- "properties": {
- "accessCount": {
- "type": "long"
- },
- "accessDate": {
- "type": "date"
- },
- "createDate": {
- "type": "date"
- },
- "url": {
- "type": "text",
- "fields": {
- "keyword": {
- "type": "keyword",
- "ignore_above": 2048
- }
- }
- }
- }
- },
- "visualization": {
- "properties": {
- "description": {
- "type": "text"
- },
- "kibanaSavedObjectMeta": {
- "properties": {
- "searchSourceJSON": {
- "type": "text"
- }
- }
- },
- "savedSearchId": {
- "type": "keyword"
- },
- "title": {
- "type": "text"
- },
- "uiStateJSON": {
- "type": "text"
- },
- "version": {
- "type": "integer"
- },
- "visState": {
- "type": "text"
- }
- }
- }
- }
- }
- }
-}
diff --git a/x-pack/test/functional/fixtures/kbn_archiver/discover/feature_controls/custom_space.json b/x-pack/test/functional/fixtures/kbn_archiver/discover/feature_controls/custom_space.json
new file mode 100644
index 0000000000000..d6c52e43984e2
--- /dev/null
+++ b/x-pack/test/functional/fixtures/kbn_archiver/discover/feature_controls/custom_space.json
@@ -0,0 +1,16 @@
+{
+ "attributes": {
+ "fields": "[{\"name\":\"@message\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@message.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"@tags\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@tags.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"@timestamp\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"_id\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_score\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_source\",\"type\":\"_source\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"agent\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"agent.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"bytes\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"clientip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"extension\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"extension.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.coordinates\",\"type\":\"geo_point\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.dest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.src\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.srcdest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"headings\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"headings.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"host.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"id\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"index.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"ip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"links\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"links.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"machine.os\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"machine.os.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"machine.ram\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"memory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.char\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.related\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.firstname\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.lastname\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"phpmemory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"referer\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:modified_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:published_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:section\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:section.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:tag\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:tag.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image:height\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:height.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image:width\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:width.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:site_name\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:site_name.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:type.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:card\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:card.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:site\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:site.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"request\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"request.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"response\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"response.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"spaces\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"spaces.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"utc_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"xss\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"xss.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true}]",
+ "timeFieldName": "@timestamp",
+ "title": "logstash-*"
+ },
+ "coreMigrationVersion": "7.15.0",
+ "id": "logstash-*",
+ "migrationVersion": {
+ "index-pattern": "7.11.0"
+ },
+ "references": [],
+ "type": "index-pattern",
+ "updated_at": "2018-12-21T00:43:07.096Z",
+ "version": "WzYsMl0="
+}
diff --git a/x-pack/test/functional/fixtures/kbn_archiver/discover/feature_controls/spaces.json b/x-pack/test/functional/fixtures/kbn_archiver/discover/feature_controls/spaces.json
new file mode 100644
index 0000000000000..9ddc185cf3535
--- /dev/null
+++ b/x-pack/test/functional/fixtures/kbn_archiver/discover/feature_controls/spaces.json
@@ -0,0 +1,32 @@
+{
+ "attributes": {
+ "buildNum": 9007199254740991,
+ "defaultIndex": "logstash-*"
+ },
+ "coreMigrationVersion": "7.15.0",
+ "id": "7.15.0",
+ "migrationVersion": {
+ "config": "7.13.0"
+ },
+ "references": [],
+ "type": "config",
+ "updated_at": "2021-08-04T13:18:45.677Z",
+ "version": "WzksMl0="
+}
+
+{
+ "attributes": {
+ "fields": "[{\"name\":\"@message\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@message.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"@tags\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@tags.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"@timestamp\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"_id\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_score\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_source\",\"type\":\"_source\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"agent\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"agent.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"bytes\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"clientip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"extension\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"extension.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.coordinates\",\"type\":\"geo_point\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.dest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.src\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.srcdest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"headings\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"headings.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"host.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"id\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"index.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"ip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"links\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"links.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"machine.os\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"machine.os.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"machine.ram\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"memory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.char\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.related\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.firstname\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.lastname\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"phpmemory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"referer\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:modified_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:published_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:section\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:section.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:tag\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:tag.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image:height\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:height.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image:width\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:width.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:site_name\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:site_name.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:type.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:card\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:card.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:site\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:site.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"request\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"request.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"response\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"response.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"spaces\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"spaces.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"utc_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"xss\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"xss.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true}]",
+ "timeFieldName": "@timestamp",
+ "title": "logstash-*"
+ },
+ "coreMigrationVersion": "7.15.0",
+ "id": "logstash-*",
+ "migrationVersion": {
+ "index-pattern": "7.11.0"
+ },
+ "references": [],
+ "type": "index-pattern",
+ "updated_at": "2018-12-21T00:43:07.096Z",
+ "version": "WzQsMl0="
+}
diff --git a/x-pack/test/ui_capabilities/security_and_spaces/tests/catalogue.ts b/x-pack/test/ui_capabilities/security_and_spaces/tests/catalogue.ts
index afd8d1fb54cf6..aeaaf7fca1cb7 100644
--- a/x-pack/test/ui_capabilities/security_and_spaces/tests/catalogue.ts
+++ b/x-pack/test/ui_capabilities/security_and_spaces/tests/catalogue.ts
@@ -53,6 +53,7 @@ export default function catalogueTests({ getService }: FtrProviderContext) {
catalogueId !== 'ml' &&
catalogueId !== 'ml_file_data_visualizer' &&
catalogueId !== 'monitoring' &&
+ catalogueId !== 'osquery' &&
!esFeatureExceptions.includes(catalogueId)
);
expect(uiCapabilities.value!.catalogue).to.eql(expected);
@@ -74,6 +75,7 @@ export default function catalogueTests({ getService }: FtrProviderContext) {
'appSearch',
'workplaceSearch',
'spaces',
+ 'osquery',
...esFeatureExceptions,
];
const expected = mapValues(
diff --git a/x-pack/test/ui_capabilities/security_and_spaces/tests/nav_links.ts b/x-pack/test/ui_capabilities/security_and_spaces/tests/nav_links.ts
index b87a6475526f7..6a6b618c2c8c8 100644
--- a/x-pack/test/ui_capabilities/security_and_spaces/tests/nav_links.ts
+++ b/x-pack/test/ui_capabilities/security_and_spaces/tests/nav_links.ts
@@ -42,7 +42,7 @@ export default function navLinksTests({ getService }: FtrProviderContext) {
expect(uiCapabilities.success).to.be(true);
expect(uiCapabilities.value).to.have.property('navLinks');
expect(uiCapabilities.value!.navLinks).to.eql(
- navLinksBuilder.except('ml', 'monitoring')
+ navLinksBuilder.except('ml', 'monitoring', 'osquery')
);
break;
case 'everything_space_all at everything_space':
@@ -57,7 +57,8 @@ export default function navLinksTests({ getService }: FtrProviderContext) {
'monitoring',
'enterpriseSearch',
'appSearch',
- 'workplaceSearch'
+ 'workplaceSearch',
+ 'osquery'
)
);
break;
diff --git a/x-pack/test/ui_capabilities/security_only/tests/catalogue.ts b/x-pack/test/ui_capabilities/security_only/tests/catalogue.ts
index d64b4f75e20a6..da4b26106afac 100644
--- a/x-pack/test/ui_capabilities/security_only/tests/catalogue.ts
+++ b/x-pack/test/ui_capabilities/security_only/tests/catalogue.ts
@@ -53,6 +53,7 @@ export default function catalogueTests({ getService }: FtrProviderContext) {
catalogueId !== 'ml' &&
catalogueId !== 'monitoring' &&
catalogueId !== 'ml_file_data_visualizer' &&
+ catalogueId !== 'osquery' &&
!esFeatureExceptions.includes(catalogueId)
);
expect(uiCapabilities.value!.catalogue).to.eql(expected);
@@ -70,6 +71,7 @@ export default function catalogueTests({ getService }: FtrProviderContext) {
'enterpriseSearch',
'appSearch',
'workplaceSearch',
+ 'osquery',
...esFeatureExceptions,
];
const expected = mapValues(
diff --git a/x-pack/test/ui_capabilities/security_only/tests/nav_links.ts b/x-pack/test/ui_capabilities/security_only/tests/nav_links.ts
index 4d96532b83d4a..6a44b3d8f0b71 100644
--- a/x-pack/test/ui_capabilities/security_only/tests/nav_links.ts
+++ b/x-pack/test/ui_capabilities/security_only/tests/nav_links.ts
@@ -42,7 +42,7 @@ export default function navLinksTests({ getService }: FtrProviderContext) {
expect(uiCapabilities.success).to.be(true);
expect(uiCapabilities.value).to.have.property('navLinks');
expect(uiCapabilities.value!.navLinks).to.eql(
- navLinksBuilder.except('ml', 'monitoring')
+ navLinksBuilder.except('ml', 'monitoring', 'osquery')
);
break;
case 'read':
@@ -55,7 +55,8 @@ export default function navLinksTests({ getService }: FtrProviderContext) {
'monitoring',
'enterpriseSearch',
'appSearch',
- 'workplaceSearch'
+ 'workplaceSearch',
+ 'osquery'
)
);
break;