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

Make checks inside Pattern check services #5384

Merged

Conversation

asteriscos
Copy link
Member

Description

Hi team,

This PR migrates the timeFilter, metaFields, maxBuckets checks inside the pattern check.

Issues Resolved

Closes #5310

Evidence

image

Test

To test this pull request enable or disable health-check configuration in wazuh.yml.

Pattern enabled

wazuh.yml entries to change:

checks.pattern: true
checks.metaFields: false
checks.timeFilter: false
checks.maxBuckets: false

The pattern check log should look like this:

INFO: Index pattern id in cookie: yes [wazuh-alerts-*]
INFO: Getting list of valid index patterns...
INFO: Valid index patterns found: 1
INFO: Found default index pattern with title [wazuh-alerts-*]: yes
INFO: Checking the app default pattern exists: id [wazuh-alerts-*]...
INFO: Default pattern with id [wazuh-alerts-*] exists: yes
ACTION: Default pattern id [wazuh-alerts-*] set as default index pattern
INFO: Checking the index pattern id [wazuh-alerts-*] exists...
INFO: Index pattern id exists [wazuh-alerts-*]: yes
INFO: Index pattern id in cookie: yes [wazuh-alerts-*]
INFO: Checking if the index pattern id [wazuh-alerts-*] exists...
INFO: Index pattern id [wazuh-alerts-*] found: yes title [wazuh-alerts-*]
INFO: Checking if exists a template compatible with the index pattern title [wazuh-alerts-*]
INFO: Template found for the selected index-pattern title [wazuh-alerts-*]: yes
INFO: Index pattern id in cookie: [wazuh-alerts-*]
INFO: Getting index pattern data [wazuh-alerts-*]...
INFO: Index pattern data found: [yes]
INFO: Refreshing index pattern fields: title [wazuh-alerts-*], id [wazuh-alerts-*]...
ACTION: Refreshed index pattern fields: title [wazuh-alerts-*], id [wazuh-alerts-*]
INFO: Check [maxBuckets]: disabled. Skipped.
INFO: Check [metaFields]: disabled. Skipped.
INFO: Check [timeFilter]: disabled. Skipped.

Pattern disabled

wazuh.yml entries to change:

checks.pattern: false
checks.metaFields: true
checks.timeFilter: true
checks.maxBuckets: true

The pattern check log should look like this:

INFO: Check [pattern]: disabled. Some minimal tasks will be done.
INFO: Index pattern id in cookie: yes [wazuh-alerts-*]
INFO: Getting list of valid index patterns...
INFO: Valid index patterns found: 1
INFO: Found default index pattern with title [wazuh-alerts-*]: yes
INFO: Checking the app default pattern exists: id [wazuh-alerts-*]...
INFO: Default pattern with id [wazuh-alerts-*] exists: yes
ACTION: Default pattern id [wazuh-alerts-*] set as default index pattern
INFO: Checking the index pattern id [wazuh-alerts-*] exists...
INFO: Index pattern id exists [wazuh-alerts-*]: yes
INFO: Index pattern id in cookie: yes [wazuh-alerts-*]
INFO: Checking if the index pattern id [wazuh-alerts-*] exists...
INFO: Index pattern id [wazuh-alerts-*] found: yes title [wazuh-alerts-*]
INFO: Checking if exists a template compatible with the index pattern title [wazuh-alerts-*]
INFO: Template found for the selected index-pattern title [wazuh-alerts-*]: yes
INFO: Index pattern id in cookie: [wazuh-alerts-*]
INFO: Getting index pattern data [wazuh-alerts-*]...
INFO: Index pattern data found: [yes]
INFO: Refreshing index pattern fields: title [wazuh-alerts-*], id [wazuh-alerts-*]...
ACTION: Refreshed index pattern fields: title [wazuh-alerts-*], id [wazuh-alerts-*]
INFO: Getting settings...
INFO: Check Wazuh dashboard setting [timeline:max_buckets]: 200000
INFO: App setting [timeline:max_buckets]: 200000
INFO: Settings mismatch [timeline:max_buckets]: no
INFO: Getting settings...
INFO: Check Wazuh dashboard setting [metaFields]: ["_source","_index"]
INFO: App setting [metaFields]: ["_source","_index"]
INFO: Settings mismatch [metaFields]: no
INFO: Getting settings...
INFO: Check Wazuh dashboard setting [timepicker:timeDefaults]: {"from":"now-24h","to":"now"}
INFO: App setting [timepicker:timeDefaults]: "{\"from\":\"now-24h\",\"to\":\"now\"}"
INFO: Settings mismatch [timepicker:timeDefaults]: no

Check List

  • All tests pass
    • yarn test:jest
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

@asteriscos asteriscos requested a review from a team as a code owner April 18, 2023 10:04
@asteriscos asteriscos self-assigned this Apr 18, 2023
@asteriscos asteriscos linked an issue Apr 18, 2023 that may be closed by this pull request
2 tasks
@Desvelao
Copy link
Member

Desvelao commented Apr 18, 2023

There are some unused variables in public/components/health-check/container/health-check.container.tsx
image
image

@Desvelao
Copy link
Member

Desvelao commented Apr 18, 2023

Wazuh dashboard

Legend:
⚫: none
🟢: pass
🟡: warning
🔴: fail
⚪: not applicable

UI

Test Chrome
With the checks.pattern enabled, enable the checks.maxBuckets, checks.metaFields and checks.timeFilter, the platform setting checks should run and update the change if needed 🟢
With the checks.pattern disabled, enable the checks.maxBuckets, checks.metaFields and checks.timeFilter, the platform setting checks should run and update the change if needed 🟢
With the checks.pattern disabled, disable the checks.maxBuckets, checks.metaFields and checks.timeFilter, the platform setting checks should not run 🟢

Details

🟢 With the `checks.pattern` enabled, enable the `checks.maxBuckets`, `checks.metaFields` and `checks.timeFilter`, the platform setting checks should run and update the change if needed

Chrome - 🟢
image

🟢 With the `checks.pattern` disabled, enable the `checks.maxBuckets`, `checks.metaFields` and `checks.timeFilter`, the platform setting checks should run and update the change if needed

Chrome - 🟢
image
image

🟢 With the `checks.pattern` disabled, disable the `checks.maxBuckets`, `checks.metaFields` and `checks.timeFilter`, the platform setting checks should not run

Chrome - 🟢
image
image

Copy link
Member

@Desvelao Desvelao left a comment

Choose a reason for hiding this comment

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

review

🟢 code
🟢 tests #5384 (comment)

@yenienserrano
Copy link
Member

yenienserrano commented Apr 18, 2023

Wazuh dashboard

Legend:
⚫: none
🟢: pass
🟡: warning
🔴: fail
⚪: not applicable

UI

Test Chrome
With the checks.pattern enabled, enable the checks.maxBuckets, checks.metaFields and checks.timeFilter, the platform setting checks should run and update the change if needed 🟢
With the checks.pattern disabled, enable the checks.maxBuckets, checks.metaFields and checks.timeFilter, the platform setting checks should run and update the change if needed 🟢
With the checks.pattern disabled, disable the checks.maxBuckets, checks.metaFields and checks.timeFilter, the platform setting checks should not run 🟢

Details

🟢 With the `checks.pattern` enabled, enable the `checks.maxBuckets`, `checks.metaFields` and `checks.timeFilter`, the platform setting checks should run and update the change if needed

Chrome - 🟢
image

🟢 With the `checks.pattern` disabled, enable the `checks.maxBuckets`, `checks.metaFields` and `checks.timeFilter`, the platform setting checks should run and update the change if needed

Chrome - 🟢

image

🟢 With the `checks.pattern` disabled, disable the `checks.maxBuckets`, `checks.metaFields` and `checks.timeFilter`, the platform setting checks should not run

Chrome - 🟢
image

@asteriscos asteriscos merged commit 41d9a3f into 4.5 Apr 18, 2023
4 of 5 checks passed
@asteriscos asteriscos deleted the enhance/move-settings-checks-to-alerts-index-checks-5310 branch April 18, 2023 14:51
github-actions bot pushed a commit that referenced this pull request Apr 18, 2023
* Make checks inside Pattern check services

* Add changelog

* refactor checkPluginPlatformSettings and code cleaning

(cherry picked from commit 41d9a3f)
github-actions bot pushed a commit that referenced this pull request Apr 18, 2023
* Make checks inside Pattern check services

* Add changelog

* refactor checkPluginPlatformSettings and code cleaning

(cherry picked from commit 41d9a3f)
asteriscos added a commit that referenced this pull request Apr 19, 2023
Make checks inside Pattern check services (#5384)

* Make checks inside Pattern check services

* Add changelog

* refactor checkPluginPlatformSettings and code cleaning

(cherry picked from commit 41d9a3f)

Co-authored-by: Federico Rodriguez <federico.rodriguez@wazuh.com>
asteriscos added a commit that referenced this pull request Apr 19, 2023
Make checks inside Pattern check services (#5384)

* Make checks inside Pattern check services

* Add changelog

* refactor checkPluginPlatformSettings and code cleaning

(cherry picked from commit 41d9a3f)

Co-authored-by: Federico Rodriguez <federico.rodriguez@wazuh.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move settings checks to alerts index check on health check page
3 participants