-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Investigate and enhance external modules logging messages #16314
Comments
UpdateStarted to read Azure |
Update - Azure WodleAzure Log AnalyticsError handling
Debug
Azure GraphError handling
Debug
Azure StorageError handling
Debug
|
UpdateAWS WodleInfo
Debug
Error Handling
Logging Format:
|
UpdateStarted developing the changes mentioned above, starting with the AWS Wodle. |
UpdateGoogle CloudError HandlingFor handling errors the wodle uses a wazuh/wodles/gcloud/exceptions.py Lines 16 to 44 in e5d9fd4
All the subclasses handle the multiple error cases the API could give, so there is no improvement to make in the structure of how the errors are handled. Log FormatThe format of the logs is the same for all the errors, as shown below: Lines 92 to 107 in e5d9fd4
|
UpdateAWSCreated an AzureAdded the changes described in earlier comments. |
UpdateAdded more logs for the logging level AzureAzure Analytics
Azure Graph
Azure Storage
|
UpdateAdded more logs for the logging level info. The list of events that are now logged is shown below: AWS
Google Cloud
|
UpdateThe Issue is blocked until the 3 Issues mentioned here related to the design of the log are completed. After these issues are completed, we need to adapt the logs created in this Issue to the new format. |
UpdateAfter multiple changes in the external modules, especially UT Results(venv) federamos@pop-os:~/Documents/Wazuh/Repositories/wazuh/wodles$ pytest .
========================================================================================================== test session starts ==========================================================================================================
platform linux -- Python 3.9.18, pytest-7.3.1, pluggy-1.5.0
rootdir: /home/federamos/Documents/Wazuh/Repositories/wazuh/wodles
configfile: pytest.ini
plugins: asyncio-0.18.1, html-2.1.1, metadata-3.1.1, tavern-1.23.5, aiohttp-1.0.4, trio-0.8.0
asyncio: mode=auto
collected 889 items
aws/tests/test_aws_bucket.py .................................................................................................................................................................................................... [ 22%]
............. [ 23%]
aws/tests/test_aws_s3.py ...................... [ 25%]
aws/tests/test_aws_service.py .... [ 26%]
aws/tests/test_cloudtrail.py .. [ 26%]
aws/tests/test_cloudwatchlogs.py ..................................................... [ 32%]
aws/tests/test_config.py .............................................................................. [ 41%]
aws/tests/test_guardduty.py ................. [ 43%]
aws/tests/test_inspector.py ...... [ 43%]
aws/tests/test_load_balancers.py ............ [ 45%]
aws/tests/test_s3_log_handler.py ....................... [ 47%]
aws/tests/test_server_access.py ................................. [ 51%]
aws/tests/test_sqs_message_processor.py ........ [ 52%]
aws/tests/test_sqs_queue.py ....... [ 53%]
aws/tests/test_tools.py .................................. [ 57%]
aws/tests/test_umbrella.py ...... [ 57%]
aws/tests/test_vpcflow.py ........................... [ 60%]
aws/tests/test_waf.py ....... [ 61%]
aws/tests/test_wazuh_integration.py ...................................................................................................... [ 73%]
azure/tests/test_azure_utils.py ................................................... [ 78%]
azure/tests/azure_services/test_analytics.py .................. [ 80%]
azure/tests/azure_services/test_graph.py ............ [ 82%]
azure/tests/azure_services/test_storage.py ........................... [ 85%]
azure/tests/db/test_db_utils.py ......... [ 86%]
azure/tests/db/test_orm.py ............................... [ 89%]
docker-listener/tests/test_docker_listener.py ................... [ 91%]
gcloud/tests/test_bucket.py ................................. [ 95%]
gcloud/tests/test_gcloud.py ......... [ 96%]
gcloud/tests/test_integration.py ........ [ 97%]
gcloud/tests/test_subscriber.py .............. [ 99%]
gcloud/tests/test_tools.py ........ [100%]
========================================================================================================== 889 passed in 4.53s ========================================================================================================== Comments about AWSSome of the |
Description
As mentioned in #14535, the debug mode (
wazuh_modules.debug=2
) is disabled by default, therefore when not enabled, the logging of the different modules does not give enough information if there are warning or error messages, making harder the troubleshooting.For example, in case of a
Throttling Exception
in the AWS module, the user would only see the debug message if the debug level is 2 due to the following section of code:wazuh/wodles/aws/aws_s3.py
Lines 1059 to 1064 in 78bbd9f
Those types of errors are difficult to reproduce because they depend on several variables such as environment congestion, number of requests to the service, etc.
Another example is regarding the different allowed regions for the AWS module. In some AWS services, in case a non-existent region is used in the module's execution, there is no warning message:
Fake region defined in Config bucket
We should review the different messages and debug levels used in order to make error troubleshooting simpler so that the solution can be carried out quickly. As well, if it is a module error itself, its reproduction should be easier to carry out.
Tasks
The text was updated successfully, but these errors were encountered: