-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
New labels format in json #3490
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add Valgrind, Scan-build and Address Sanitizer
…om/wazuh/wazuh into fix-3429-labels_response_on-demand
Hi team This is logs of the valgrind:
The compilation supervised with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add tests as discussed.
The JSON that is generated in the function
|
After discussing it with the @wazuh/framework, it doesn't make sense to include the
Please @SalvaMilenario apply the changes and test it works fine. Ping @wazuh/frontend as well to check it is a valid format for you to parse this JSON format to XML. |
Hi I've changed the code with the new JSON format: # curl -u foo:bar -k -X GET "http://172.16.1.13:55000/agents/001/config/agent/labels?pretty"
{
"error": 0,
"data": {
"labels": [
{
"value": "i-001c",
"key": "id",
"hidden": "no"
},
{
"value": "default",
"key": "group",
"hidden": "no"
},
{
"value": "172.16.1.14",
"key": "ip",
"hidden": "no"
},
{
"value": "Sep 18th, 2019",
"key": "installation",
"hidden": "yes"
}
]
}
}
The compilation supervised with
Regards |
TestThe API call works correctly and shows the new # curl -u foo:bar -k -X GET "http://10.0.0.1:55000/agents/014/config/agent/labels?pretty"
{
"error": 0,
"data": {
"labels": [
{
"value": "i-052a1838d",
"key": "aws.instance-id",
"hidden": "no"
},
{
"value": "sg-1103",
"key": "aws.sec-group",
"hidden": "no"
},
{
"value": "172.17.0.0",
"key": "network.ip",
"hidden": "no"
},
{
"value": "02:42:ac:11:00:02",
"key": "network.mac",
"hidden": "no"
},
{
"value": "January 1st, 2017",
"key": "installation",
"hidden": "yes"
}
]
}
} This information is also displayed in the kibana app: |
Working on it here wazuh/wazuh-dashboard-plugins#1816 |
TestNew JSON format added to the manager. The API call works correctly and shows the new # curl -u foo:bar -k -X GET "http://10.0.0.1:55000/manager/config/analysis/labels?pretty"
{
"error": 0,
"data": {
"labels": [
{
"value": "i-052a1838c",
"key": "aws.instance-id",
"hidden": "no"
},
{
"value": "sg-1103",
"key": "aws.sec-group",
"hidden": "no"
},
{
"value": "172.17.0.0",
"key": "network.ip",
"hidden": "no"
},
{
"value": "02:42:ac:11:00:02",
"key": "network.mac",
"hidden": "no"
},
{
"value": "January 1st, 2017",
"key": "installation",
"hidden": "yes"
}
]
}
} |
Tests were added after the review
Description
The format of the labels is changed so that they appear by levels as it is encoded in JSON.
The new format shows in addition to the name of the key and its value tagged as such, it has been added to show if it is a hidden label.
Additionally, the expected behavior when saving two labels with the same key is that only the second one that is entered is saved.
The format with which the labels are displayed is:
Tests