mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[Fleet] removed restriction to use remote es as integration data (#173353)
## Summary Closes https://github.com/elastic/kibana/issues/173237 Removed restriction to allow using remote es output as integration data output. ### Steps to verify: #### Send system integration data to remote es - Create a remote es output, verify that the output is allowed to be set as default for agent integrations - Create an agent policy with system integration and set the remote es output as integration data output - Enroll an agent to the agent policy - Check the remote kibana - Discover, verify that system metrics are coming in from the agent - Install system package on the remote cluster to see dashboards, mappings, etc. #### Send nginx integration data to remote es - Add nginx integration to the agent policy - Create a dummy nginx log file in `/var/tmp/nginx/access.log` and add some dummy data to it - Verify that the data from the nginx log file appears in the remote kibana Discover in `logs-*` data view. #### Back to default output - Change the agent policy integration output back to default - Verify that the system integration data is ingested in the main cluster. - Verify that the API key is invalidated in the remote cluster <img width="1742" alt="image" src="47ed4e89
-e761-4f24-90c3-bf3a49a6b4f1"> <img width="937" alt="image" src="2e41f37e
-a4ef-4f18-aed0-d4160efe306a"> <img width="2162" alt="image" src="bf5d900b
-f3bd-493e-b61a-4554224a97fc"> <img width="2150" alt="image" src="31e4f32e
-8751-4b02-855f-dc7fbd5e64a9"> System dashboard on remote cluster populated: <img width="2157" alt="image" src="dfb10791
-ab15-4058-9170-7cad51935493"> ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
This commit is contained in:
parent
86ed41ed3c
commit
4d35abe9b6
6 changed files with 31 additions and 52 deletions
|
@ -28,9 +28,9 @@ export function getAllowedOutputTypeForPolicy(agentPolicy: AgentPolicy) {
|
|||
agentPolicy.package_policies &&
|
||||
agentPolicy.package_policies.some(
|
||||
(p) =>
|
||||
p.package?.name === FLEET_APM_PACKAGE ||
|
||||
p.package?.name === FLEET_SERVER_PACKAGE ||
|
||||
p.package?.name === FLEET_SYNTHETICS_PACKAGE
|
||||
p.package?.name === FLEET_SYNTHETICS_PACKAGE ||
|
||||
p.package?.name === FLEET_APM_PACKAGE
|
||||
);
|
||||
|
||||
if (isRestrictedToSameClusterES) {
|
||||
|
|
|
@ -533,7 +533,7 @@ describe('useOutputOptions', () => {
|
|||
`);
|
||||
});
|
||||
|
||||
it('should only enable remote es output for monitoring output', async () => {
|
||||
it('should enable remote es output for data and monitoring output', async () => {
|
||||
const testRenderer = createFleetTestRendererMock();
|
||||
mockedUseLicence.mockReturnValue({
|
||||
hasAtLeast: () => true,
|
||||
|
@ -545,7 +545,8 @@ describe('useOutputOptions', () => {
|
|||
expect(result.current.isLoading).toBeTruthy();
|
||||
|
||||
await waitForNextUpdate();
|
||||
expect(result.current.dataOutputOptions.length).toEqual(1);
|
||||
expect(result.current.dataOutputOptions.length).toEqual(2);
|
||||
expect(result.current.dataOutputOptions[1].value).toEqual('remote1');
|
||||
expect(result.current.monitoringOutputOptions.length).toEqual(2);
|
||||
expect(result.current.monitoringOutputOptions[1].value).toEqual('remote1');
|
||||
});
|
||||
|
|
|
@ -16,7 +16,7 @@ import {
|
|||
useGetDownloadSources,
|
||||
useGetFleetServerHosts,
|
||||
} from '../../../../hooks';
|
||||
import { LICENCE_FOR_PER_POLICY_OUTPUT, outputType } from '../../../../../../../common/constants';
|
||||
import { LICENCE_FOR_PER_POLICY_OUTPUT } from '../../../../../../../common/constants';
|
||||
import {
|
||||
getAllowedOutputTypeForPolicy,
|
||||
policyHasFleetServer,
|
||||
|
@ -99,28 +99,26 @@ export function useOutputOptions(agentPolicy: Partial<NewAgentPolicy | AgentPoli
|
|||
|
||||
return [
|
||||
getDefaultOutput(defaultOutputName, defaultOutputDisabled, defaultOutputDisabledMessage),
|
||||
...outputsRequest.data.items
|
||||
.filter((item) => item.type !== outputType.RemoteElasticsearch)
|
||||
.map((item) => {
|
||||
const isOutputTypeUnsupported = !allowedOutputTypes.includes(item.type);
|
||||
...outputsRequest.data.items.map((item) => {
|
||||
const isOutputTypeUnsupported = !allowedOutputTypes.includes(item.type);
|
||||
|
||||
return {
|
||||
value: item.id,
|
||||
inputDisplay: getOutputLabel(
|
||||
item.name,
|
||||
isOutputTypeUnsupported ? (
|
||||
<FormattedMessage
|
||||
id="xpack.fleet.agentPolicyForm.outputOptionDisabledTypeNotSupportedText"
|
||||
defaultMessage="{outputType} output for agent integration is not supported for Fleet Server, Synthetics or APM."
|
||||
values={{
|
||||
outputType: item.type,
|
||||
}}
|
||||
/>
|
||||
) : undefined
|
||||
),
|
||||
disabled: !isPolicyPerOutputAllowed || isOutputTypeUnsupported,
|
||||
};
|
||||
}),
|
||||
return {
|
||||
value: item.id,
|
||||
inputDisplay: getOutputLabel(
|
||||
item.name,
|
||||
isOutputTypeUnsupported ? (
|
||||
<FormattedMessage
|
||||
id="xpack.fleet.agentPolicyForm.outputOptionDisabledTypeNotSupportedText"
|
||||
defaultMessage="{outputType} output for agent integration is not supported for Fleet Server, Synthetics or APM."
|
||||
values={{
|
||||
outputType: item.type,
|
||||
}}
|
||||
/>
|
||||
) : undefined
|
||||
),
|
||||
disabled: !isPolicyPerOutputAllowed || isOutputTypeUnsupported,
|
||||
};
|
||||
}),
|
||||
];
|
||||
}, [outputsRequest, isPolicyPerOutputAllowed, allowedOutputTypes]);
|
||||
|
||||
|
|
|
@ -542,7 +542,6 @@ export const EditOutputFlyout: React.FunctionComponent<EditOutputFlyoutProps> =
|
|||
}}
|
||||
/>
|
||||
}
|
||||
disabled={isRemoteESOutput}
|
||||
/>
|
||||
</EuiFormRow>
|
||||
<EuiFormRow fullWidth {...inputs.defaultMonitoringOutputInput.formRowProps}>
|
||||
|
|
|
@ -705,12 +705,12 @@ describe('Output Service', () => {
|
|||
);
|
||||
});
|
||||
|
||||
it('should throw when a remote es output is attempted to be created as default data output', async () => {
|
||||
it('should not throw when a remote es output is attempted to be created as default data output', async () => {
|
||||
const soClient = getMockedSoClient({
|
||||
defaultOutputId: 'output-test',
|
||||
});
|
||||
|
||||
await expect(
|
||||
expect(
|
||||
outputService.create(
|
||||
soClient,
|
||||
esClientMock,
|
||||
|
@ -722,9 +722,7 @@ describe('Output Service', () => {
|
|||
},
|
||||
{ id: 'output-1' }
|
||||
)
|
||||
).rejects.toThrow(
|
||||
`Remote elasticsearch output cannot be set as default output for integration data. Please set "is_default" to false.`
|
||||
);
|
||||
).resolves.not.toThrow();
|
||||
});
|
||||
|
||||
it('should set preset: balanced by default when creating a new ES output', async () => {
|
||||
|
@ -1644,21 +1642,19 @@ describe('Output Service', () => {
|
|||
);
|
||||
});
|
||||
|
||||
it('should throw when a remote es output is attempted to be updated as default data output', async () => {
|
||||
it('should not throw when a remote es output is attempted to be updated as default data output', async () => {
|
||||
const soClient = getMockedSoClient({
|
||||
defaultOutputId: 'output-test',
|
||||
});
|
||||
|
||||
await expect(
|
||||
expect(
|
||||
outputService.update(soClient, esClientMock, 'output-test', {
|
||||
is_default: true,
|
||||
is_default_monitoring: false,
|
||||
name: 'Test',
|
||||
type: 'remote_elasticsearch',
|
||||
})
|
||||
).rejects.toThrow(
|
||||
`Remote elasticsearch output cannot be set as default output for integration data. Please set "is_default" to false.`
|
||||
);
|
||||
).resolves.not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -441,13 +441,6 @@ class OutputService {
|
|||
logger.debug(`Creating new output`);
|
||||
|
||||
const data: OutputSOAttributes = { ...omit(output, ['ssl', 'secrets']) };
|
||||
if (output.type === outputType.RemoteElasticsearch) {
|
||||
if (data.is_default) {
|
||||
throw new OutputInvalidError(
|
||||
'Remote elasticsearch output cannot be set as default output for integration data. Please set "is_default" to false.'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (outputTypeSupportPresets(data.type)) {
|
||||
if (
|
||||
|
@ -767,14 +760,6 @@ class OutputService {
|
|||
const logger = appContextService.getLogger();
|
||||
logger.debug(`Updating output ${id}`);
|
||||
|
||||
if (data.type === outputType.RemoteElasticsearch) {
|
||||
if (data.is_default) {
|
||||
throw new OutputInvalidError(
|
||||
'Remote elasticsearch output cannot be set as default output for integration data. Please set "is_default" to false.'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
let secretsToDelete: PolicySecretReference[] = [];
|
||||
const originalOutput = await this.get(soClient, id);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue