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

Ruleset test messages #4244

Merged
merged 7 commits into from
Jun 14, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes to the Wazuh app project will be documented in this file.

## Wazuh v4.3.5 - Kibana 7.10.2, 7.16.x, 7.17.x - Revision 4306

### Added

- Added to the interface API messages in the Ruleset test module [#4244](https://github.com/wazuh/wazuh-kibana-app/pull/4244)

## Wazuh v4.3.4 - Kibana 7.10.2, 7.16.x, 7.17.x - Revision 4305

### Added
Expand Down
18 changes: 16 additions & 2 deletions public/directives/wz-logtest/components/logtest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import { UI_LOGGER_LEVELS } from '../../../../common/constants';
import { getErrorOrchestrator } from '../../../react-services/common-services';
import { WzFlyout } from '../../../components/common/flyouts';
import _ from 'lodash';
import { getToasts } from '../../../kibana-services';
yenienserrano marked this conversation as resolved.
Show resolved Hide resolved

type LogstestProps = {
openCloseFlyout: () => {};
Expand All @@ -71,7 +72,7 @@ export const Logtest = compose(
};

// Format the result of the Wazuh API response to an output similar one to the `wazuh-logtest` utility
const formatResult = (result, alert) => {
const formatResult = (result, alert, messages) => {
// How to the `wazuh-logtest` utility logs the output:
// https://github.com/wazuh/wazuh/blob/master/framework/scripts/wazuh-logtest.py#L359-L397

Expand Down Expand Up @@ -100,6 +101,19 @@ export const Logtest = compose(
});
}

// Output messages
if(messages){
logging.push('**Messages:')

let message = ''

messages.forEach((msg) => {
message += '\t' + msg + '\n'
})
yenienserrano marked this conversation as resolved.
Show resolved Hide resolved

logging.push(message)
}

// Pre-decoding phase
logging.push('**Phase 1: Completed pre-decoding.');
// Check in case rule has no_full_log attribute
Expand Down Expand Up @@ -171,7 +185,7 @@ export const Logtest = compose(
}
const testResults = responses.map((response) => {
return response.data.data.output || ''
? formatResult(response.data.data.output, response.data.data.alert)
? formatResult(response.data.data.output, response.data.data.alert, response.data.data.messages)
: `No result found for: ${response.data.data.output.full_log}`;
}).join('\n\n');
setTestResult(testResults);
Expand Down