Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Security Solution][Detection Engine] updates ES|QL info popover #168611

Merged
merged 26 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
96e0790
esql popover
vitaliidm Oct 6, 2023
61698b3
Merge branch 'main' into detection-engine/esql-popover
vitaliidm Oct 11, 2023
f94026a
update popover
vitaliidm Oct 12, 2023
bdf387a
Merge branch 'main' into detection-engine/esql-popover
vitaliidm Oct 12, 2023
85ba226
fixes
vitaliidm Oct 12, 2023
8f5c7d2
Merge branch 'detection-engine/esql-popover' of ssh://github.com/vita…
vitaliidm Oct 12, 2023
5227900
Merge branch 'main' into detection-engine/esql-popover
vitaliidm Oct 13, 2023
e5dcc2e
refactoring
vitaliidm Oct 13, 2023
8c8a2f5
Merge branch 'detection-engine/esql-popover' of ssh://github.com/vita…
vitaliidm Oct 13, 2023
4f64052
fix checks
vitaliidm Oct 13, 2023
2149a44
Merge branch 'main' into detection-engine/esql-popover
vitaliidm Oct 13, 2023
0ad9774
Merge branch 'main' into detection-engine/esql-popover
vitaliidm Oct 13, 2023
743a3d5
Update translations.ts
vitaliidm Oct 16, 2023
506df03
Update esql_rule_ess.cy.ts
vitaliidm Oct 16, 2023
b3baceb
Merge branch 'main' into detection-engine/esql-popover
vitaliidm Oct 16, 2023
fa888e1
Merge branch 'main' into detection-engine/esql-popover
vitaliidm Oct 16, 2023
284c430
Update x-pack/plugins/security_solution/public/detection_engine/rule_…
vitaliidm Oct 16, 2023
e882045
Merge branch 'main' into detection-engine/esql-popover
vitaliidm Oct 16, 2023
e2d8c3e
update text
vitaliidm Oct 16, 2023
bf12c5d
Merge branch 'detection-engine/esql-popover' of ssh://github.com/vita…
vitaliidm Oct 16, 2023
6307811
Update translations.ts
vitaliidm Oct 17, 2023
d8cf3f5
Update translations.ts
vitaliidm Oct 17, 2023
f73d58d
Update translations.ts
vitaliidm Oct 17, 2023
374f5cf
Update esql_rule_ess.cy.ts
vitaliidm Oct 17, 2023
95bc652
Merge branch 'main' into detection-engine/esql-popover
vitaliidm Oct 17, 2023
f267022
Merge branch 'main' into detection-engine/esql-popover
vitaliidm Oct 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions packages/kbn-doc-links/src/get_doc_links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,7 @@ export const getDocLinks = ({ kibanaBranch }: GetDocLinkOptions): DocLinks => {
},
privileges: `${SECURITY_SOLUTION_DOCS}endpoint-management-req.html`,
manageDetectionRules: `${SECURITY_SOLUTION_DOCS}rules-ui-management.html`,
createEsqlRuleType: `${SECURITY_SOLUTION_DOCS}rules-ui-create.html#create-esql-rule`,
},
query: {
eql: `${ELASTICSEARCH_DOCS}eql.html`,
Expand Down Expand Up @@ -854,9 +855,6 @@ export const getDocLinks = ({ kibanaBranch }: GetDocLinkOptions): DocLinks => {
synthetics: {
featureRoles: `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/synthetics-feature-roles.html`,
},
esql: {
statsBy: `${ELASTICSEARCH_DOCS}esql.html`,
},
telemetry: {
settings: `${KIBANA_DOCS}telemetry-settings-kbn.html`,
},
Expand Down
4 changes: 1 addition & 3 deletions packages/kbn-doc-links/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ export interface DocLinks {
};
readonly privileges: string;
readonly manageDetectionRules: string;
readonly createEsqlRuleType: string;
};
readonly query: {
readonly eql: string;
Expand Down Expand Up @@ -611,9 +612,6 @@ export interface DocLinks {
readonly synthetics: {
readonly featureRoles: string;
};
readonly esql: {
readonly statsBy: string;
};
readonly telemetry: {
readonly settings: string;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,13 @@
*/

import React from 'react';
import { EuiPopover, EuiText, EuiButtonIcon } from '@elastic/eui';
import { Markdown } from '@kbn/kibana-react-plugin/public';
import { EuiPopover, EuiText, EuiButtonIcon, EuiLink } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import * as i18n from './translations';

import { useBoolState } from '../../../../common/hooks/use_bool_state';

import { useKibana } from '../../../../common/lib/kibana';

const POPOVER_WIDTH = 640;

/**
* Icon and popover that gives hint to users how to get started with ES|QL rules
*/
Expand All @@ -30,14 +27,20 @@ const EsqlInfoIconComponent = () => {

return (
<EuiPopover button={button} isOpen={isPopoverOpen} closePopover={closePopover}>
<EuiText style={{ width: POPOVER_WIDTH }} size="s">
<Markdown
markdown={i18n.getTooltipContent(
docLinks.links.esql.statsBy,
// Docs team will provide actual link to a new page before release
// For now, it's just a mock
docLinks.links.esql.statsBy
)}
<EuiText size="s">
<FormattedMessage
id="xpack.securitySolution.detectionEngine.createRule.stepDefineRule.esqlInfoTooltipContent"
defaultMessage="Check out our {createEsqlRuleTypeLink} to get started using ES|QL rules."
values={{
createEsqlRuleTypeLink: (
<EuiLink href={docLinks.links.securitySolution.createEsqlRuleType} target="_blank">
<FormattedMessage
id="xpack.securitySolution.detectionEngine.createRule.stepDefineRule.esqlInfoTooltipLink"
defaultMessage="documentation"
/>
</EuiLink>
),
}}
/>
</EuiText>
</EuiPopover>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,39 +13,3 @@ export const ARIA_LABEL = i18n.translate(
defaultMessage: `Open help popover`,
}
);

export const getTooltipContent = (statsByLink: string, startUsingEsqlLink: string) =>
i18n.translate(
'xpack.securitySolution.detectionEngine.createRule.stepDefineRule.esqlInfoTooltipContent',
{
defaultMessage: `
### Aggregating rule
Is a rule that uses {statsByLink} grouping commands. So, its result can not be matched with a particular document in ES.
\`\`\`
FROM logs*
| STATS count = COUNT(host.name) BY host.name
| SORT host.name
\`\`\`


### Non-aggregating rule
Is a rule that does not use {statsByLink} grouping commands. Hence, each row in result can be tracked to a source document in ES. For this type of rule,
please use operator \`[metadata _id, _index, _version]\` after defining index source. This would allow deduplicate alerts and link them with the source document.

Example

\`\`\`
FROM logs* [metadata _id, _index, _version]
| WHERE event.id == "test"
| LIMIT 10
\`\`\`

Please, ensure, metadata properties \`id\`, \`_index\`, \`_version\` are carried over through pipe operators.
`,
values: {
statsByLink: `[STATS..BY](${statsByLink})`,
// Docs team will provide actual link to a new page before release
// startUsingEsqlLink: `[WIP: Get started using ES|QL rules](${startUsingEsqlLink})`,
},
}
);
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ export const esqlValidationErrorMessage = (message: string) =>
export const ESQL_VALIDATION_MISSING_ID_IN_QUERY_ERROR = i18n.translate(
'xpack.securitySolution.detectionEngine.esqlValidation.missingIdInQueryError',
{
defaultMessage: `For non-aggregating rules(that don't use STATS..BY function), please write query that returns _id field from [metadata _id, _version, _index] operator`,
defaultMessage: `For non-aggregating queries(that don't use STATS..BY function), use [metadata _id, _version, _index] operator after source index and ensure _id property is returned in response`,
}
);
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export const ESQL_TYPE_TITLE = i18n.translate(
export const ESQL_TYPE_DESCRIPTION = i18n.translate(
'xpack.securitySolution.detectionEngine.createRule.stepDefineRule.ruleTypeField.esqlTypeDescription',
{
defaultMessage: 'Use The Elasticsearch Query Language (ES|QL) to search or aggregate events',
defaultMessage:
'Use Elasticsearch Query Language (ES|QL) to find events and aggregate search results.',
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ describe('Detection ES|QL rules, creation', { tags: ['@ess'] }, () => {
getDefineContinueButton().click();

cy.get(ESQL_QUERY_BAR).contains(
'write query that returns _id field from [metadata _id, _version, _index] operator'
'use [metadata _id, _version, _index] operator after source index and ensure _id property is returned in response'
);
});

Expand All @@ -139,7 +139,7 @@ describe('Detection ES|QL rules, creation', { tags: ['@ess'] }, () => {
getDefineContinueButton().click();

cy.get(ESQL_QUERY_BAR).contains(
'write query that returns _id field from [metadata _id, _version, _index] operator'
'use [metadata _id, _version, _index] operator after source index and ensure _id property is returned in response'
);
});

Expand Down