Merge branch '3.9-6.6'

This commit is contained in:
Jesús Ángel 2019-03-13 18:08:40 +01:00
commit e1270a36fe
6 changed files with 131 additions and 106 deletions

View File

@ -54,6 +54,7 @@ All notable changes to the Wazuh app project will be documented in this file.
- Adapted Wazuh icon for multiple browsers where it was gone ([#1208](https://github.com/wazuh/wazuh-kibana-app/pull/1208)).
- Do not fetch data from tables twice when resize window ([#1303](https://github.com/wazuh/wazuh-kibana-app/pull/1303)).
- Agent syncrhonization status is updated as we browse the configuration section ([#1305](https://github.com/wazuh/wazuh-kibana-app/pull/1305))
- Using the browser timezone for reporting documents ([#1311](https://github.com/wazuh/wazuh-kibana-app/pull/1311)).
## Wazuh v3.8.2 - Kibana v6.6.0 / v6.6.1 - Revision 419

View File

@ -41,11 +41,13 @@ export class LogsController {
this.initialize();
this.$scope.$on('wazuhFetched', (ev, parameters) => {
this.$scope.XMLContent = this.parseLogsToText(parameters.items);
this.$scope.XMLContent = this.parseLogsToText(parameters.items) || '';
this.$scope.$broadcast('XMLContentReady', {
data: this.$scope.XMLContent
});
this.$scope.$applyAsync();
this.$scope.$broadcast('doRefresh', { type: 'xml' });
});
this.$scope.$on('scrolledToBottom', (ev, parameters) => {
@ -59,11 +61,11 @@ export class LogsController {
parseLogsToText(logs) {
let result = '';
logs.forEach(function(log, idx) {
logs.forEach(function (log, idx) {
if (log) {
result = result.concat(
`${log.timestamp} ${log.tag} ${(log.level || '').toUpperCase()}: ${
log.description
log.description
}`
);
if (idx !== logs.length - 1) {
@ -193,10 +195,10 @@ export class LogsController {
const data = clusterEnabled
? await this.apiReq.request(
'GET',
`/cluster/${this.selectedNode}/logs/summary`,
{}
)
'GET',
`/cluster/${this.selectedNode}/logs/summary`,
{}
)
: await this.apiReq.request('GET', '/manager/logs/summary', {});
const daemons = data.data.data;
this.daemons = Object.keys(daemons).map(item => ({ title: item }));
@ -207,4 +209,4 @@ export class LogsController {
}
return;
}
}
}

View File

@ -77,7 +77,7 @@ class WzConfigViewer {
setTimeout(function() {
$scope.jsonCodeBox.refresh();
$scope.$applyAsync();
}, 100);
}, 200);
}
};
@ -91,7 +91,7 @@ class WzConfigViewer {
setTimeout(function() {
$scope.xmlCodeBox.refresh();
$scope.$applyAsync();
}, 100);
}, 200);
}
};
@ -128,7 +128,15 @@ class WzConfigViewer {
$scope.xmlCodeBox.getScrollerElement().offsetHeight / 2;
$scope.xmlCodeBox.scrollTo(null, t - middleHeight - 10);
});
$scope.$on('doRefresh', (ev, params) => {
if (params.type === 'xml') {
$scope.xmlCodeBox.refresh();
} else {
$scope.jsonCodeBox.refresh();
}
});
}
}
app.directive('wzConfigViewer', () => new WzConfigViewer());
app.directive('wzConfigViewer', () => new WzConfigViewer());

View File

@ -11,7 +11,8 @@
*/
import $ from 'jquery';
import moment from 'moment'
import moment from 'moment';
export class ReportingService {
constructor(
$rootScope,

View File

@ -1,97 +1,104 @@
<div layout="column" class="mozilla-table-size-85" ng-controller="managerLogController as ctrl"
ng-if="!ctrl.loading && mctrl.tab == 'logs'">
<div layout="column" class="mozilla-table-size-85" ng-controller="managerLogController as ctrl" ng-if="!ctrl.loading && mctrl.tab == 'logs'">
<!-- Headline -->
<div ng-show="!ctrl.loading" layout="column" layout-padding>
<span class="font-size-18"><i class="fa fa-fw fa-pencil-square-o" aria-hidden="true"></i> Logs</span>
<span class="md-subheader">Review the logs of all Wazuh manager daemons</span>
</div>
<!-- End headline -->
<!-- Filters and Realtime button section -->
<div ng-show="!ctrl.loading" layout="row" layout-align="start center" class="md-padding-h">
<!-- Daemon selector -->
<div flex="20" layout="column" layout-align="center" class="height-40 wz-margin-right-15 wz-select-input">
<select flex class="kuiSelect wz-border-none cursor-pointer max-height-35"
ng-disabled="ctrl.realtime || !ctrl.daemons.length" id="categoryBox" ng-model="ctrl.category"
ng-change="ctrl.filter({name:'category',value:ctrl.category})" aria-label="Logs category">
<option value="all">All daemons</option>
<option ng-repeat="daemon in ctrl.daemons | orderObjectBy: 'title'" value="{{daemon.title}}">
{{daemon.title}}</option>
</select>
<!-- Headline -->
<div ng-show="!ctrl.loading" layout="column" layout-padding>
<span class="font-size-18"><i class="fa fa-fw fa-pencil-square-o" aria-hidden="true"></i> Logs</span>
<span class="md-subheader">Review the logs of all Wazuh manager daemons</span>
</div>
<!-- End daemon selector -->
<!-- Level selector -->
<div flex="20" layout="column" layout-align="center" class="height-40 wz-select-input wz-margin-right-15">
<select flex class="kuiSelect wz-border-none cursor-pointer max-height-35" ng-disabled="ctrl.realtime"
id="levelBox" ng-model="ctrl.type_log" ng-change="ctrl.filter({name:'type_log',value:ctrl.type_log})"
aria-label="Logs level">
<option value="all">All log levels</option>
<option value="info">Info</option>
<option value="error">Error</option>
<option value="warning">Warning</option>
<option value="critical">Critical</option>
<option value="debug">Debug</option>
</select>
<!-- End headline -->
<!-- Filters and Realtime button section -->
<div ng-show="!ctrl.loading" layout="row" layout-align="start center" class="md-padding-h">
<!-- Daemon selector -->
<div flex="20" layout="column" layout-align="center" class="height-40 wz-margin-right-15 wz-select-input">
<select flex class="kuiSelect wz-border-none cursor-pointer max-height-35" ng-disabled="ctrl.realtime || !ctrl.daemons.length"
id="categoryBox" ng-model="ctrl.category" ng-change="ctrl.filter({name:'category',value:ctrl.category})"
aria-label="Logs category">
<option value="all">All daemons</option>
<option ng-repeat="daemon in ctrl.daemons | orderObjectBy: 'title'" value="{{daemon.title}}">
{{daemon.title}}</option>
</select>
</div>
<!-- End daemon selector -->
<!-- Level selector -->
<div flex="20" layout="column" layout-align="center" class="height-40 wz-select-input wz-margin-right-15">
<select flex class="kuiSelect wz-border-none cursor-pointer max-height-35" ng-disabled="ctrl.realtime" id="levelBox"
ng-model="ctrl.type_log" ng-change="ctrl.filter({name:'type_log',value:ctrl.type_log})" aria-label="Logs level">
<option value="all">All log levels</option>
<option value="info">Info</option>
<option value="error">Error</option>
<option value="warning">Warning</option>
<option value="critical">Critical</option>
<option value="debug">Debug</option>
</select>
</div>
<div flex="20" layout="column" ng-show="ctrl.nodeList" layout-align="center" class="height-40 wz-select-input wz-margin-right-15">
<select flex class="kuiSelect wz-border-none cursor-pointer max-height-35" ng-disabled="ctrl.realtime" id="categoryBox"
ng-model="ctrl.selectedNode" ng-change="ctrl.changeNode(ctrl.selectedNode)" aria-label="Logs category">
<option ng-repeat="node in ctrl.nodeList" value="{{node}}">{{node}}</option>
</select>
</div>
<div flex="20" layout="column" layout-align="center" class="height-40">
<wz-kbn-switch switch-model="ctrl.sortFilter" switch-change="ctrl.sort()" switch-text="Descending sort">
</wz-kbn-switch>
</div>
<!-- End Level selector -->
<!-- White space between filters and Realtime button -->
<span flex></span>
<md-button ng-if="!ctrl.realtime" class="wz-button no-margin-right" ng-click="ctrl.playRealtime()" aria-label="Play realtime button">
<i class="fa fa-play fa-fw" aria-hidden="true"></i>
Play realtime
</md-button>
<md-button ng-if="ctrl.realtime" class="wz-button no-margin-right" ng-click="ctrl.stopRealtime()" aria-label="Stop realtime button">
<i class="fa fa-stop fa-fw" aria-hidden="true"></i>
Stop realtime
</md-button>
</div>
<div flex="20" layout="column" layout-align="center" class="height-40 wz-margin-right-15">
<wz-kbn-switch switch-model="ctrl.sortFilter" switch-change="ctrl.sort()" switch-text="Descending sort">
</wz-kbn-switch>
<!-- End Filters and Realtime button section -->
<div layout="row" flex class="md-padding-h wz-margin-top-10" ng-if="ctrl.logsPath">
<input placeholder="Filter logs..." ng-model="ctrl.custom_search" type="text" class="kuiLocalSearchInput ng-empty ng-pristine ng-scope ng-touched ng-valid"
aria-invalid="false" wz-enter="ctrl.search(ctrl.custom_search)">
<button type="submit" aria-label="Search" class="kuiLocalSearchButton height-40" ng-click="ctrl.search(ctrl.custom_search)">
<span class="fa fa-search" aria-hidden="true"></span>
</button>
</div>
<div flex="20" layout="column" ng-show="ctrl.nodeList" layout-align="center" class="height-40 wz-select-input">
<select flex class="kuiSelect wz-border-none cursor-pointer max-height-35" ng-disabled="ctrl.realtime"
id="categoryBox" ng-model="ctrl.selectedNode" ng-change="ctrl.changeNode(ctrl.selectedNode)"
aria-label="Logs category">
<option ng-repeat="node in ctrl.nodeList" value="{{node}}">{{node}}</option>
</select>
<!-- Logs section -->
<div layout="row" layout-padding ng-if="ctrl.logsPath" ng-hide="true">
<wz-table path="ctrl.logsPath" keys="[]" implicit-sort="'timestamp'"></wz-table>
</div>
<!-- End Level selector -->
<!-- White space between filters and Realtime button -->
<span flex></span>
<md-button ng-if="!ctrl.realtime" class="wz-button no-margin-right" ng-click="ctrl.playRealtime()"
aria-label="Play realtime button">
<i class="fa fa-play fa-fw" aria-hidden="true"></i>
Play realtime
</md-button>
<md-button ng-if="ctrl.realtime" class="wz-button no-margin-right" ng-click="ctrl.stopRealtime()"
aria-label="Stop realtime button">
<i class="fa fa-stop fa-fw" aria-hidden="true"></i>
Stop realtime
</md-button>
</div>
<!-- End Filters and Realtime button section -->
<div layout="row" flex class="md-padding-h wz-margin-top-10" ng-if="ctrl.logsPath">
<input placeholder="Filter logs..." ng-model="ctrl.custom_search" type="text"
class="kuiLocalSearchInput ng-empty ng-pristine ng-scope ng-touched ng-valid" aria-invalid="false"
wz-enter="ctrl.search(ctrl.custom_search)">
<button type="submit" aria-label="Search" class="kuiLocalSearchButton height-40"
ng-click="ctrl.search(ctrl.custom_search)">
<span class="fa fa-search" aria-hidden="true"></span>
</button>
</div>
<!-- Logs section -->
<div layout="row" layout-padding ng-if="ctrl.logsPath" ng-hide="true">
<wz-table path="ctrl.logsPath" keys="[]" implicit-sort="'timestamp'"></wz-table>
</div>
<div ng-show="XMLContent">
<div layout="row" layout-padding class="wz-padding-bottom-0">
<wz-config-viewer flex xmlcontent="XMLContent" hide-header="true" />
<div ng-show="XMLContent">
<div layout="row" layout-padding class="wz-padding-bottom-0">
<wz-config-viewer flex xmlcontent="XMLContent" hide-header="true" />
</div>
<md-card flex class="wz-md-card _md flex md-margin-h">
<md-card-actions layout="row" layout-align="end center" class="wz-card-actions layout-align-end-center wz-no-margin layout-row height-25">
<a class="small" id="btnDownload" ng-click="ctrl.downloadCsv()">Formatted <i aria-hidden="true" class="fa fa-fw fa-download"></i></a>
</md-card-actions>
</md-card>
</div>
<md-card flex class="wz-md-card _md flex md-margin-h">
<md-card-actions layout="row" layout-align="end center"
class="wz-card-actions layout-align-end-center wz-no-margin layout-row height-25">
<a class="small" id="btnDownload" ng-click="ctrl.downloadCsv()">Formatted <i aria-hidden="true"
class="fa fa-fw fa-download"></i></a>
</md-card-actions>
</md-card>
</div>
<!-- End Logs section -->
</div>
<!-- End Logs section -->
<div layout="row" class="md-padding-h" ng-show="XMLContent === ''">
<div flex class="euiCallOut euiCallOut--warning wz-margin-top-17">
<div class="euiCallOutHeader">
<svg class="euiIcon euiIcon--medium euiCallOutHeader__icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16">
<defs>
<path id="help-a" d="M13.6 12.186l-1.357-1.358c-.025-.025-.058-.034-.084-.056.53-.794.84-1.746.84-2.773a4.977 4.977 0 0 0-.84-2.772c.026-.02.059-.03.084-.056L13.6 3.813a6.96 6.96 0 0 1 0 8.373zM8 15A6.956 6.956 0 0 1 3.814 13.6l1.358-1.358c.025-.025.034-.057.055-.084C6.02 12.688 6.974 13 8 13a4.978 4.978 0 0 0 2.773-.84c.02.026.03.058.056.083l1.357 1.358A6.956 6.956 0 0 1 8 15zm-5.601-2.813a6.963 6.963 0 0 1 0-8.373l1.359 1.358c.024.025.057.035.084.056A4.97 4.97 0 0 0 3 8c0 1.027.31 1.98.842 2.773-.027.022-.06.031-.084.056l-1.36 1.358zm5.6-.187A4 4 0 1 1 8 4a4 4 0 0 1 0 8zM8 1c1.573 0 3.019.525 4.187 1.4l-1.357 1.358c-.025.025-.035.057-.056.084A4.979 4.979 0 0 0 8 3a4.979 4.979 0 0 0-2.773.842c-.021-.027-.03-.059-.055-.084L3.814 2.4A6.957 6.957 0 0 1 8 1zm0-1a8.001 8.001 0 1 0 .003 16.002A8.001 8.001 0 0 0 8 0z"></path>
</defs>
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#help-a" fill-rule="evenodd"></use>
</svg>
<span class="euiCallOutHeader__title">No results match your search criteria</span>
</div>
</div>
</div>
</div>

View File

@ -247,7 +247,11 @@ export class WazuhReportingCtrl {
const hours = date.getHours();
const minutes = date.getMinutes();
const seconds = date.getSeconds();
const str = `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}T${hours < 10 ? '0' + hours : hours}:${minutes < 10 ? '0' + minutes : minutes}:${seconds < 10 ? '0' + seconds : seconds}`;
const str = `${year}-${month < 10 ? '0' + month : month}-${
day < 10 ? '0' + day : day
}T${hours < 10 ? '0' + hours : hours}:${
minutes < 10 ? '0' + minutes : minutes
}:${seconds < 10 ? '0' + seconds : seconds}`;
return str;
}
@ -258,8 +262,10 @@ export class WazuhReportingCtrl {
* @param {String} filters E.g: cluster.name: wazuh AND rule.groups: vulnerability
*/
renderTimeRangeAndFilters(from, to, filters, timeZone) {
const fromDate = new Date(new Date(from).toLocaleString("en-US", { timeZone }));
const toDate = new Date(new Date(to).toLocaleString("en-US", { timeZone }));
const fromDate = new Date(
new Date(from).toLocaleString('en-US', { timeZone })
);
const toDate = new Date(new Date(to).toLocaleString('en-US', { timeZone }));
const str = `${this.formatDate(fromDate)} to ${this.formatDate(toDate)}`;
this.dd.content.push({