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

[Statistics] Remove logged error related to the creation of an existent index #4235

Conversation

Desvelao
Copy link
Member

@Desvelao Desvelao commented Jun 9, 2022

Description

This PR removes the logging when there is an error checking or creating the index.

If the error is not related to creating an existent index, this is thrown, caught, and logged in another method.

More information in:

The plugin logs, it should look similar to the screenshot when is initiated:
image
compare to the error seen in:
image

Closes #4203

Tests

  • It should not be logged an error related to resource_already_exists_exception when creating the index of statistics job.
    Requirements:
    • Secure that depending on the statistics job configuration, a new index should be created when the job runs.
    • Give to the internal Kibana user, permissions to create and index data in the indices related to the statistics job

…creating an existent index

The statistics jobs run in parallel and they try to create the same
index. One of them runs the request to create the index successfully, but
the other one fails due to the index already existing. This error is caught
and logged.

If the error is not related to the index exists, this is thrown and it
is caught and logged in another method related to the statistics job

More information in:
- #4203 (comment)
@Desvelao Desvelao force-pushed the fix/4203-fix-statistics-remove-log-cause-error-creating-existent-index branch from 3800abe to 9c44be7 Compare June 9, 2022 07:41
@Desvelao Desvelao linked an issue Jun 9, 2022 that may be closed by this pull request
@Desvelao Desvelao requested a review from a team June 9, 2022 07:45
@Desvelao Desvelao changed the base branch from master to 4.3-7.10 June 9, 2022 07:57
Copy link
Member

@AlexRuiz7 AlexRuiz7 left a comment

Choose a reason for hiding this comment

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

  • Code Review: ✔️
  • Test: ✔️

Copy link
Member

@yenienserrano yenienserrano left a comment

Choose a reason for hiding this comment

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

LGTM

image

@Desvelao Desvelao merged commit ad2c9c4 into 4.3-7.10 Jun 14, 2022
@Desvelao Desvelao deleted the fix/4203-fix-statistics-remove-log-cause-error-creating-existent-index branch June 14, 2022 10:41
@github-actions
Copy link
Contributor

The backport to 4.3-7.16 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-4.3-7.16 4.3-7.16
# Navigate to the new working tree
cd .worktrees/backport-4.3-7.16
# Create a new branch
git switch --create backport-4235-to-4.3-7.16
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 ad2c9c414acb327bd36573c297a4e04d8e77248e
# Push it to GitHub
git push --set-upstream origin backport-4235-to-4.3-7.16
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-4.3-7.16

Then, create a pull request where the base branch is 4.3-7.16 and the compare/head branch is backport-4235-to-4.3-7.16.

@github-actions
Copy link
Contributor

The backport to 4.3-1.2-wzd failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-4.3-1.2-wzd 4.3-1.2-wzd
# Navigate to the new working tree
cd .worktrees/backport-4.3-1.2-wzd
# Create a new branch
git switch --create backport-4235-to-4.3-1.2-wzd
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 ad2c9c414acb327bd36573c297a4e04d8e77248e
# Push it to GitHub
git push --set-upstream origin backport-4235-to-4.3-1.2-wzd
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-4.3-1.2-wzd

Then, create a pull request where the base branch is 4.3-1.2-wzd and the compare/head branch is backport-4235-to-4.3-1.2-wzd.

Desvelao added a commit that referenced this pull request Jun 14, 2022
…nt index (#4235)

* fix(statistics): remove the logging when there is an error caused by creating an existent index

The statistics jobs run in parallel and they try to create the same
index. One of them runs the request to create the index successfully, but
the other one fails due to the index already existing. This error is caught
and logged.

If the error is not related to the index exists, this is thrown and it
is caught and logged in another method related to the statistics job

More information in:
- #4203 (comment)

* changelog: add the PR entry

* changelog: fixes Wazuh version and revision

* Update CHANGELOG.md

Co-authored-by: Álex <alejandro.ruiz.becerra@wazuh.com>
Desvelao added a commit that referenced this pull request Jun 14, 2022
…nt index (#4235)

* fix(statistics): remove the logging when there is an error caused by creating an existent index

The statistics jobs run in parallel and they try to create the same
index. One of them runs the request to create the index successfully, but
the other one fails due to the index already existing. This error is caught
and logged.

If the error is not related to the index exists, this is thrown and it
is caught and logged in another method related to the statistics job

More information in:
- #4203 (comment)

* changelog: add the PR entry

* changelog: fixes Wazuh version and revision

* Update CHANGELOG.md

Co-authored-by: Álex <alejandro.ruiz.becerra@wazuh.com>
@github-actions
Copy link
Contributor

Jest Test Coverage % values
Statements 4.09% ( 1489 / 36387 )
Branches 1.67% ( 473 / 28242 )
Functions 3.06% ( 272 / 8898 )
Lines 4.14% ( 1440 / 34804 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error messages on a clean install—error app log messages
3 participants