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

Fixed error logging UI logs due to logger undefined property #7267

Merged
merged 2 commits into from
Feb 3, 2025

Conversation

Desvelao
Copy link
Member

@Desvelao Desvelao commented Jan 31, 2025

Description

This pull request fixes an error logging UI logs due to logger undefined property.

Issues Resolved

#7265

Evidence

Sending an UI error:
image

Using an external tool:

curl -k -u admin:admin -XPOST https://localhost:5601/utils/logs/ui -H "content-type:application/json" -H 'osd-xsrf:kibana' -d '{"level":"error","location":"test","message":"Test"}'
{"statusCode":200,"error":0,"message":"Log has been added"}

Test

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

Backend

Test Result
Force to send an UI error or use an external tool (cURL) to the POST /utils/logs/ui and ensure thius replies with {"statusCode":200,"error":0,"message":"Log has been added"} and you can see the log in the Wazuh dashboard logs

If you want to use an external tool:
curl -k -u admin:admin -XPOST <WAZUH_DASHBOARD_URL>/utils/logs/ui -H "content-type:application/json" -H 'osd-xsrf:kibana' -d '{"level":"error","location":"test","message":"Test"}'

Details

⚫ Force to send an UI error or use an external tool (cURL) to the POST /utils/logs/ui and ensure thius replies with {"statusCode":200,"error":0,"message":"Log has been added"} and you can see the log in the Wazuh dashboard logs

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

@Desvelao Desvelao self-assigned this Jan 31, 2025
Copy link
Contributor

Wazuh Core plugin code coverage (Jest) test % values
Statements 45.3% ( 400 / 883 )
Branches 41.09% ( 157 / 382 )
Functions 43.31% ( 136 / 314 )
Lines 45.48% ( 398 / 875 )

Copy link
Contributor

Wazuh Check Updates plugin code coverage (Jest) test % values
Statements 78.72% ( 185 / 235 )
Branches 62.72% ( 69 / 110 )
Functions 61.7% ( 29 / 47 )
Lines 78.72% ( 185 / 235 )

@Desvelao Desvelao linked an issue Jan 31, 2025 that may be closed by this pull request
Copy link
Contributor

Main plugin code coverage (Jest) test % values
Statements 15.46% ( 4620 / 29877 )
Branches 10.15% ( 1955 / 19260 )
Functions 15.38% ( 1112 / 7230 )
Lines 15.69% ( 4511 / 28749 )

@Desvelao Desvelao marked this pull request as ready for review January 31, 2025 08:52
@yenienserrano yenienserrano self-requested a review January 31, 2025 11:39
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
image

image

@JuanGarriuz JuanGarriuz self-requested a review February 3, 2025 08:37
@JuanGarriuz
Copy link
Member

JuanGarriuz commented Feb 3, 2025

Test

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

Backend

Test Result
Force to send an UI error or use an external tool (cURL) to the POST /utils/logs/ui and ensure thius replies with {"statusCode":200,"error":0,"message":"Log has been added"} and you can see the log in the Wazuh dashboard logs 🟢

If you want to use an external tool:
curl -k -u admin:admin -XPOST <WAZUH_DASHBOARD_URL>/utils/logs/ui -H "content-type:application/json" -H 'osd-xsrf:kibana' -d '{"level":"error","location":"test","message":"Test"}'

Details

🟢 Force to send an UI error or use an external tool (cURL) to the POST /utils/logs/ui and ensure thius replies with {"statusCode":200,"error":0,"message":"Log has been added"} and you can see the log in the Wazuh dashboard logs

From External

curl -k -u admin:admin -XPOST https://localhost:5601/utils/logs/ui -H "content-type:application/json" -H 'osd-xsrf:kibana' -d '{"level":"error","location":"test","message":"Test"}'
{"statusCode":200,"error":0,"message":"Log has been added"}

image

From Dashboard

image

image

Copy link
Member

@JuanGarriuz JuanGarriuz 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
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.

CR: 🟢
Test: 🟢

Forced an exception and the logger endpoint works as expected

image

image

@asteriscos asteriscos merged commit 0b4ede1 into 4.12.0 Feb 3, 2025
5 checks passed
@asteriscos asteriscos deleted the bug/7265-error-ui-logs-backend-side branch February 3, 2025 11:20
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.

Cannot read logger of undefined
4 participants