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

[8.11] [Security Solution] Adds feature flag to enable/disable ESQL in timeline (#174029) #174112

Merged
merged 4 commits into from
Jan 3, 2024

Conversation

spong
Copy link
Member

@spong spong commented Jan 2, 2024

Backport

This will backport the following commits from main to 8.11:

Questions ?

Please refer to the Backport tool documentation

…ine (elastic#174029)

## Summary

This PR introduces a feature flag `timelineEsqlTabDisabled` which is by
default `false`. This gives customer ability to disable the esql tab by
enabling this experimental feature flag as below in `kibana.yml`

```yaml
xpack.securitySolution.enableExperimental:
  - timelineEsqlTabDisabled

```

The availability of ESQL Tab in timeline also affects `AI Assistant` as
it facilities re-directing user to timeline with an esql query. That
`redirect` button should not be available for `esql` query if ESQL Tab
is disabled.

## Desk Testing

1. ESQL Tab Presence
    -  timelineEsqlTabDisabled :  true
- If Tab is disabled, `ESQL` Tab should not show when timeline is open.
Timeline should also not fire any `bsearch` requests with `esql`
strategy.
- ESQL tab is enabled i.e. `timelineEsqlTabDisabled : true` is present
in kibana.dev.yml
- User should be able to use ESQL queries without any issue. Below
should be the default query in both `8.12` and `8.11.4`
       ```esql
from
.alerts-security.alerts-default,apm-*-transaction*,auditbeat-*,endgame-*,filebeat-*,logs-*,packetbeat-*,traces-apm*,winlogbeat-*,-*elastic-cloud-logs-*
| limit 10 | keep @timestamp, message, event.category, event.action,
host.name, source.ip, destination.ip, user.name
       ```
2. Open ESQL Tab from URL
    1. Enable ESQL tab and Activate it when in timeline
2. Now change `kibana.dev.yml` to add experimental flag
`timelineEsqlTabDisabled` to disable ESQL Tab.
    3. Restart kibana server
    4. Refresh the page in step 1 where `ESQL` tab was active
    5. User should automatically be redirected to `Query` tab.

3. AI Assistant
Today AI Assistant can help user add an ESQL query to the timeline as
shown in below video.
We need to make sure that `Send to timeline` button is not available
only for `esql` queries when above experimental flag is enabled.

https://github.com/elastic/kibana/assets/7485038/e452a6c6-cf97-462e-a5dc-bd8c0fd38d58

---------

Co-authored-by: Gloria Hornero <[email protected]>
Co-authored-by: kibanamachine <[email protected]>
(cherry picked from commit da0370e)

# Conflicts:
#	x-pack/plugins/security_solution/common/experimental_features.ts
#	x-pack/plugins/security_solution/public/timelines/components/timeline/tabs_content/index.tsx
@elasticmachine
Copy link
Contributor

CI was triggered for this PR, but this PR targets 8.11 which should not receive a future release. CI is not supported for these branches. Please consult the release schedule, or contact #kibana-operations if you believe this is an error.

The following branches are currently considered to be open:

  • main
  • 8.12
  • 7.17

@@ -132,6 +134,7 @@ const ActiveTimelineTab = memo<ActiveTimelineTabProps>(
setConversationId,
showTimeline,
}) => {
const isEsqlSettingEnabled = useKibana().services.configSettings.ESQLEnabled;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@logeekal, based on the note in #173640, I think we need to remove all occurrences of isEsqlSettingEnabled.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spong, Conditional render should same as here without isEsqlSettingEnabled. Does that make sense?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

>
<EsqlTab timelineId={timelineId} />
</HideShowContainer>
{showTimeline && isEsqlSettingEnabled && activeTimelineTab === TimelineTabs.esql && (
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this conditional goes away entirely as well since not already in 8.11?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This conditional is now the same as https://github.com/elastic/kibana/pull/173640/files#diff-c9eb10e636b9cedb21368945df018d08cb60b87ccf469be22cbab0abd7ae5ed3R182, which should merge first and be an empty change here.

Resolving conflicts as detailed from elastic#173640
@elasticmachine
Copy link
Contributor

CI was triggered for this PR, but this PR targets 8.11 which should not receive a future release. CI is not supported for these branches. Please consult the release schedule, or contact #kibana-operations if you believe this is an error.

The following branches are currently considered to be open:

  • main
  • 8.12
  • 7.17

Comment on lines +183 to +190
{showTimeline && activeTimelineTab === TimelineTabs.esql && (
<HideShowContainer
$isVisible={true}
data-test-subj={`timeline-tab-content-${TimelineTabs.esql}`}
>
<EsqlTab timelineId={timelineId} />
</HideShowContainer>
)}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@logeekal logeekal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. Desk tested. LGTM 🚀

@jbudz
Copy link
Member

jbudz commented Jan 2, 2024

buildkite test this

@kibana-ci
Copy link
Collaborator

kibana-ci commented Jan 3, 2024

💔 Build Failed

Failed CI Steps

Test Failures

  • [job] [logs] Security Solution Cypress Tests #3 / Alert tagging Add and remove a tag using the alert bulk action menu Add and remove a tag using the alert bulk action menu
  • [job] [logs] Investigations - Security Solution Cypress Tests #8 / Detections : Page Filters Impact of inputs "after each" hook for "should recover from invalid kql Query result" "after each" hook for "should recover from invalid kql Query result"
  • [job] [logs] Investigations - Security Solution Cypress Tests #8 / Detections : Page Filters Impact of inputs should recover from invalid kql Query result should recover from invalid kql Query result

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
securitySolution 13.0MB 13.0MB +1.7KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
securitySolution 63.0KB 63.0KB +27.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@PhilippeOberti PhilippeOberti merged commit 8832416 into elastic:8.11 Jan 3, 2024
26 of 30 checks passed
@spong spong deleted the backport/8.11/pr-174029 branch January 3, 2024 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants