-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Security Solution] Improve rule execution logging (#166070)
**Relates to:** #126063 ## Summary This PR extends rule event log's filter and improves log messages. ## Details We have Rule execution log feature hidden by a feature flag and disabled, it's shown on a rule details page when enabled. <img width="1782" alt="image" src="https://github.com/elastic/kibana/assets/3775283/71565d96-13aa-4275-b870-22118ac90335"> The feature is close to a releasable state but some tasks had to be addressed to make it usable. This PR addresses the following tasks to make rule execution log feature releasable - Adds search bar to search for specific messages <img width="1529" alt="image" src="https://github.com/elastic/kibana/assets/3775283/4bd198de-60e8-4511-a96d-4d68ec53a7f2"> - Adds a date range filter by default set to show logs for last 24 hours <img width="1529" alt="image" src="https://github.com/elastic/kibana/assets/3775283/b9d7e658-a19a-402a-a039-28d225000952"> - Improves error, warning and debug messages - Returns rule metrics in a message as a serialized JSON <img width="1526" alt="image" src="https://github.com/elastic/kibana/assets/3775283/7d9501b9-4a12-4d31-be99-6ce3c04b2b97"> - Adds `execution_id` to the response <img width="1522" alt="image" src="https://github.com/elastic/kibana/assets/3775283/92d1291e-0605-456c-abca-8c6fd329ade2"> ### Tasks to address later - [ ] Further improve logging messages. We have either error, warning or debug messages. In fact info or trace levels aren't used but it can give useful info. - [ ] Add an OpenAPI spec for the rule execution log endpoint
- Loading branch information
Showing
35 changed files
with
398 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...onitoring/components/execution_events_table/event_message_filter/event_message_filter.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* 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 type { ChangeEvent } from 'react'; | ||
import React, { useCallback } from 'react'; | ||
import { EuiFieldSearch } from '@elastic/eui'; | ||
import * as i18n from './translations'; | ||
|
||
interface EventMessageFilterProps { | ||
value: string; | ||
onChange: (value: string) => void; | ||
} | ||
|
||
export function EventMessageFilter({ value, onChange }: EventMessageFilterProps): JSX.Element { | ||
const handleChange = useCallback( | ||
(e: ChangeEvent<HTMLInputElement>) => onChange(e.target.value), | ||
[onChange] | ||
); | ||
|
||
return ( | ||
<EuiFieldSearch | ||
aria-label={i18n.SEARCH_BY_EVENT_MESSAGE_ARIA_LABEL} | ||
fullWidth | ||
incremental={false} | ||
placeholder={i18n.SEARCH_BY_EVENT_MESSAGE_PLACEHOLDER} | ||
value={value} | ||
onChange={handleChange} | ||
data-test-subj="ruleEventLogMessageSearchField" | ||
/> | ||
); | ||
} |
8 changes: 8 additions & 0 deletions
8
...on_engine/rule_monitoring/components/execution_events_table/event_message_filter/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 './event_message_filter'; |
22 changes: 22 additions & 0 deletions
22
...ne/rule_monitoring/components/execution_events_table/event_message_filter/translations.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* 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 { i18n } from '@kbn/i18n'; | ||
|
||
export const SEARCH_BY_EVENT_MESSAGE_ARIA_LABEL = i18n.translate( | ||
'xpack.securitySolution.detectionEngine.rules.eventLog.searchAriaLabel', | ||
{ | ||
defaultMessage: 'Search by event message', | ||
} | ||
); | ||
|
||
export const SEARCH_BY_EVENT_MESSAGE_PLACEHOLDER = i18n.translate( | ||
'xpack.securitySolution.detectionEngine.rules.eventLog.searchPlaceholder', | ||
{ | ||
defaultMessage: 'Search by event message', | ||
} | ||
); |
Oops, something went wrong.