elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.82k stars 8.2k forks source link

[RAC][Alert Triage][Timeline] Update the Alerts Table and Timeline APIs #94520

Open andrew-goldstein opened 3 years ago

andrew-goldstein commented 3 years ago

[RAC][Alert Triage][Timeline] Update the Alerts Table and Timeline APIs

Timeline-based tables provide APIs for configuring columns, customizing actions, and integrating with Kibana APIs for other concerns such as applying filters to the KQL bar at the top of the page, querying for alerts / events, and persisting investigations via saved objects.

The purpose of this issue is to update the public APIs for the Alerts Table and Timeline for consumers outside of the Security Solution.

The updated APIs must continue to provide the following functionality:

Timeline-based tables are configured via an API to provide a custom set of default columns

Timeline-based tables are configured via an API to provide a custom set of default columns for the:

The API implemented today enables each page where a Timeline-based table is used to specify a unique set of default columns. The configuration includes:

For example, the following array defines the default columns used by the Alerts table on the Detections page:

export const alertsHeaders: ColumnHeaderOptions[] = [
  {
    columnHeaderType: defaultColumnHeaderType,
    id: '@timestamp',
    width: DEFAULT_DATE_COLUMN_MIN_WIDTH + 5,
  },
  {
    columnHeaderType: defaultColumnHeaderType,
    id: 'signal.rule.name',
    label: i18n.ALERTS_HEADERS_RULE,
    linkField: 'signal.rule.id',
    width: DEFAULT_COLUMN_MIN_WIDTH,
  },
  {
    columnHeaderType: defaultColumnHeaderType,
    id: 'signal.rule.version',
    label: i18n.ALERTS_HEADERS_VERSION,
    width: 95,
  },
  {
    columnHeaderType: defaultColumnHeaderType,
    id: 'signal.rule.type',
    label: i18n.ALERTS_HEADERS_METHOD,
    width: 100,
  },
  {
    columnHeaderType: defaultColumnHeaderType,
    id: 'signal.rule.severity',
    label: i18n.ALERTS_HEADERS_SEVERITY,
    width: 105,
  },
  {
    columnHeaderType: defaultColumnHeaderType,
    id: 'signal.rule.risk_score',
    label: i18n.ALERTS_HEADERS_RISK_SCORE,
    width: 115,
  },
  {
    columnHeaderType: defaultColumnHeaderType,
    id: 'event.module',
    linkField: 'rule.reference',
    width: DEFAULT_COLUMN_MIN_WIDTH,
  },
  {
    category: 'event',
    columnHeaderType: defaultColumnHeaderType,
    id: 'event.action',
    type: 'string',
    aggregatable: true,
    width: 140,
  },
  {
    columnHeaderType: defaultColumnHeaderType,
    id: 'event.category',
    width: 150,
  },
  {
    columnHeaderType: defaultColumnHeaderType,
    id: 'host.name',
    width: 120,
  },
  {
    columnHeaderType: defaultColumnHeaderType,
    id: 'user.name',
    width: 120,
  },
  {
    columnHeaderType: defaultColumnHeaderType,
    id: 'source.ip',
    width: 120,
  },
  {
    columnHeaderType: defaultColumnHeaderType,
    id: 'destination.ip',
    width: 140,
  },
];

The column configuration above is used in the Alerts table on the Detections page below:

alerts

The Alerts table on the Detections page

Static, page-level query filters

Some pages specify static, page-level query filters to some Timeline-based tables.

The following views in the Security Solution are rendered by Timeline-based tables, which pass page-level context to the tables query (via the API):

signal.rule.id filters the Rule Details page's Timeline-based table

rule-details-page

A Rule Details page

host.name filters both the Events and External Alerts tables on Host Details pages

host-details

A Host Details page

event.kind": "alert" and source.ip: * and destination.ip: * filters the External Alerts table on the Network page

network-page

The Network page

The common View details row-level flyout interaction

All Timeline-based tables provide a row level action that, when clicked, displays the details of the alert or event in a flyout:

view-details

The View details row-level action opens an Alert Details flyout

Custom row-level actions

Today, the API enables each Timeline-based table to display a custom set of row-level actions:

alerts-table-actions

Alerts table actions

events-table-actions

Events table actions

Timeline contains the superset of all table actions, including some actions that are exclusive to Timeline itself, i.e. the Add notes for this event and Pin event actions:

timeline-table-actions

Timeline's table actions

Additional actions are programmatically provided to each table via an array of JSX.Element[]:

additonal-actions-code

Row-level actions for updating alert status, and adding rule exceptions

The Alerts view integrates with the Detections API to update the status of alerts and add rule exceptions:

row-level-alert-actions

Cases optionally link directly to Analyzer (Resolver) Graph Views via URLs

Timeline-based tables provide the Analyze Event row-level action shown below:

analyze-event

When users click the Analyze Event action, the (Resolver) process graph view is displayed as a table overlay:

analyze-event-graph

Users may attach cases that directly link to Timeline's Analyzer view, shown below:

link-directly-to-analyzer

Table-level filtering

The API enables Timeline-based tables to implement table-level filtering.

For example, the Alerts table provides filtering by alert status:

table-filters

Table-level filtering

Two-Way integration with the page-level KQL bar and filters

Timeline-based tables use Kibana APIs for two-way integration with the KQL bar and it's Filters, which are located at the top of most pages:

two-way-filtering

Two-way filtering on the Detections page

An integration with Kibana APIs enables, in the screenshot above:

Hover menu actions

All fields on a page, including chart legends and table content, are (optionally) rendered via a component that includes a hover menu that affords a consistent experience for:

Every field rendered in a Timeline-based table provides the following actions via a hover menu:

filer-for-value filter-out-value add-to-timeline-iinvestigation

Clicking the button above programmatically drag-and-drops the field to Timeline's query area:

automatic-drag-and-drop

top-field-name

Clicking the button above displays an an interactive Top N popover, shown below:

top-user-name

The animated gif below shows the Top N popover appearing when user user clicks Show top event.action in the hover menu:

top-n

The legend items rendered in the popover also contain a hover menu proffering the same actions.

copy-to-clipboard

The Copy to clipboard action formats the field and value using KQL syntax, e.g.:

user.name: "NETWORK SERVICE"

Any field on a page, whether it's rendered in a table or not, can be wrapped in a React component that provides the hover menu functionality. By default, the field is rendered / styled as a draggable.

Some applications may not wish to render fields as draggables. Thus:

Integration with the Detections API, enabling bulk-actions for changing the status of alerts (e.g. Open, Closed)

The alerts table enables integrates with the Detections API, enabling bulk-actions for changing the status of alerts (e.g. Open, Closed):

bulk-actions

User-customized columns are saved to localStorage to persist across page-loads

Users may customize the columns in a table via the Fields Browser, shown below:

fields-browser

The fields browser groups fields from multiple indexes / field mappings into a single view, organized by category, with descriptions. It also provides an affordance for resetting the table to it's specific set of default columns.

Timeline-based tables persist user-customized columns to the browser's localStorage when:

drag-and-drop-columns

add-column-via-alert-details

Timeline based tables combine query results from alert and non-alert indexes

Timeline based tables combine query results from alert and non-alert indexes.

Today, Timeline-based tables directly query alert indexes, but a new abstraction layer for querying alerts may soon be available.

Timelines persisted as saved objects

While performing an investigation, users may add inline notes to alerts and events in Timeline via Markdown:

inline-notes

Users may also pin events of interest:

pinned-events

When users are ready to share the notes and pinned events gathered during an investigation, they give the untitled timeline a name. The timeline is then in-turn persisted as a saved object in the Kibana space where it was created.

Acceptance Criteria

elasticmachine commented 3 years ago

Pinging @elastic/security-solution (Team: SecuritySolution)

elasticmachine commented 3 years ago

Pinging @elastic/security-threat-hunting (Team:Threat Hunting)

elasticmachine commented 3 years ago

Pinging @elastic/kibana-alerting-services (Team:Alerting Services)

elasticmachine commented 3 years ago

Pinging @elastic/security-detections-response (Team:Detections and Resp)

andrew-goldstein commented 3 years ago

https://github.com/elastic/kibana/pull/98241 updates the TGrid API to implement a subset of the EuiDataGridColumn API to render the example column configuration shown in the screenshot below:

observability_alerts_example