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

[FIX] [HEALH CHECK] Fix listValidIndexPatterns.find is not a function error #3698

Merged

Conversation

Desvelao
Copy link
Member

@Desvelao Desvelao commented Nov 29, 2021

Description

This PR fixes the problem in the Alerts index pattern check of the health check caused by listValidIndexPatterns.find is not a function. This error could be caused due to a problem when parsing the attributes.fields of index pattern data.

Changes

  • Ensure the attributes.fields exists in the index pattern data before parsing it
  • Removed returning with error message or error in SavedObjects.getListOfIndexPatterns and SavedObjects.getListOfWazuhValidIndexPatterns

Tests

  • The Alerts index pattern check shouldn't display the error and the index patterns should be checked and created (if necessary without problems) when the index pattern data has not attributes.fields.

Steps to reproduce:

  1. Create an index pattern through a request to Elasticsearch API:
curl -XPOST https://<ELASTICSEARCH_HOST_IP>:9200/.kibana/_doc/index-pattern:wazuh-alerts-4.x-env-1-* -k -u admin:admin -H 'Content-Type: application/json' -d '{"type":"index-pattern","index-pattern":{"title":"wazuh-alerts-4.x-env-1-*","timeFieldName":"@timestamp"}}'
  1. Go to the app (ensure accessing to health check) and see the error

Close #3695

…" error

  - Ensure the `attributes.fields` exists in the index pattern data before parsing it
  - Removed returning with error message or error in `SavedObjects.getListOfIndexPatterns` and `SavedObjects.getListOfWazuhValidIndexPatterns`
@Desvelao Desvelao added the type/bug Bug issue label Nov 29, 2021
@Desvelao Desvelao self-assigned this Nov 29, 2021
@Desvelao Desvelao changed the title [HEALH-CHECK] Fix listValidIndexPatterns.find is not a function error [FIX] [HEALH CHECK] Fix listValidIndexPatterns.find is not a function error Nov 29, 2021
@Desvelao Desvelao marked this pull request as ready for review November 30, 2021 11:56
@Machi3mfl Machi3mfl requested a review from a team November 30, 2021 12:52
Copy link
Contributor

@CPAlejandro CPAlejandro left a comment

Choose a reason for hiding this comment

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

CR: LGTM!

Copy link
Contributor

@gabiwassan gabiwassan left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@eze9252 eze9252 left a comment

Choose a reason for hiding this comment

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

LGTM!

@Desvelao Desvelao linked an issue Dec 9, 2021 that may be closed by this pull request
2 tasks
Copy link
Member

@asteriscos asteriscos left a comment

Choose a reason for hiding this comment

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

Test: ✔️
CR: ✔️

@gabiwassan
Copy link
Contributor

Test: ✅

@gabiwassan gabiwassan merged commit b33f161 into 4.2-7.10 Dec 10, 2021
@gabiwassan gabiwassan deleted the fix/health-check-error-listValidIndexPatterns.find branch December 10, 2021 17:19
gabiwassan added a commit that referenced this pull request Dec 16, 2021
* doc: update default package

* Fixed compatibility wazuh 4.2 - kibana 7.13.4 (#3653)

* Fixed compatibility wazuh 4.2 - kibana 7.13.4

* Changed xDomain in elastic chart

* Added await in getSearchRequestBody

* Updated CHANGELOG

Co-authored-by: Ibarra Maximiliano <maximiliano.ibarra@wazuh.com>
Co-authored-by: Franco Charriol <franco.charriol@wazuh.com>

* Fixed interative register windows agent screen error (#3654)

* Fixed interative register windows agent screen error

* Added toLowercase

* Updated CHANGELOG

* Update CHANGELOG.md

Co-authored-by: Ibarra Maximiliano <maximiliano.ibarra@wazuh.com>
Co-authored-by: Franco Charriol <franco.charriol@wazuh.com>

* Update CHANGELOG.md

* fix: missing async

* Fix missing import on build for kibana 7.14 (#3665)

* changed import of saved searches

* local copy of legacy/vis_update_state

* Fixed breadcrumbs style compatibility for Kibana 7.14.2 (#3668)

* Parcial breadcrumb style fix

* Improved beadcrumb styling and text overflow

* Added changelog

* Fix remove token on logout kibana 7.13 (#3670)

* Fixing EuiPannels in Overview Sections and disabled text in WzMenu (#3674)

* Fixing EuiPannels in Overview Sections

* Fixing disabled text in Wz Menu

* Fix/3673 fixing double flyout clicking in a policy (#3676)

* Fixing disabled buttons in wz menu

* Fixing double flyout

* Fixed Group Configuration and Management configuration error after trying to going back after you save (#3672)

* Solving error

* Adding Changelog.md

* Fixing bug editting user

* Fixed kibana settings conflict on health check (#3678)

* [FIX] [Compatibility] Get the valid index patterns to use in the app in Kibana 7.10.2 - 7.13.4 (#3681)

* fix(compatibility): Manage how to get the index pattern data and refresh
the fields for Kibana 7.10.2 and Kibana >=7.11.0
  - Added a function to check if the Kibana version (`kibana.version`
property of `package.json`) satisfies a specific version.
  - Modified some logic when getting the index patterns or refreshing
them to be compatible with 7.10.2 and 7.13.4. An Kibana change modified
as getting the index pattern fields.
  - Added a toast when an unknown index pattern field is detected in
Kibana >7.10.2 in Modules/<MODULE>/(Dashboard/Events) and set its life
time to 5 minutes.

Note: tested with Kibana 7.10.2 and 7.13.4 but should works in Kibana
7.11.x and 7.12.x

* changelog: Add PR to changelog

* fix(compatibility): Replaced references from 7.10.2 to 7.11 in the fixes for the compatibility to get the index pattern data and their fields and refresh them

* bump: Wazuh 4.2.5

* Replaced window location after logout

* Updated CHANGELOG

* [FIX] [TELEMETRY] Hide the banner (#3709)

* fix(telemetry): Hide the telemetry banner
  - Hide the telemetry banner from UI and set a flag in the saved object
that controls if the banner was seen and dismissed
  - Changed the `wazuh` `public` `start` method to sync intead of
`async` function

* changelog: Add PR to changelog

* fix: Add semicolon

* fix(telemetry): Hide the telemetry banner when the app frontend is to be mounted.

  Note the requirement to access to the app to hide and dissmiss the
telemetry notice. This means the banner is visible while the user
doesn't open the Wazuh app if the notice wasn't dismissed.

* [FIX] [HEALH CHECK] Fix `listValidIndexPatterns.find is not a function` error (#3698)

* fix(health-check): Fix "listValidIndexPatterns.find is not a function" error
  - Ensure the `attributes.fields` exists in the index pattern data before parsing it
  - Removed returning with error message or error in `SavedObjects.getListOfIndexPatterns` and `SavedObjects.getListOfWazuhValidIndexPatterns`

* changelog: Add PR to changelog

* added delay into request deleteToken

Co-authored-by: Franco Charriol <francocharriol@gmail.com>
Co-authored-by: Maximiliano Ibarra <maximilianoaibarra@gmail.com>
Co-authored-by: Ibarra Maximiliano <maximiliano.ibarra@wazuh.com>
Co-authored-by: Franco Charriol <franco.charriol@wazuh.com>
Co-authored-by: Federico Rodriguez <federico.rodriguez@wazuh.com>
Co-authored-by: Alejandro Cuéllar Peinado <alejandro.cuellar@wazuh.com>
Co-authored-by: Antonio <34042064+Desvelao@users.noreply.github.com>
Co-authored-by: Matias Ezequiel Moreno <matiasezequielmoreno@MacBook-Pro-de-Matias.local>
Co-authored-by: Matias Ezequiel Moreno <matiasmoreno876@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Bug issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Health check] listValidIndexPatterns.find is not a function error
5 participants