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

Visualizations with different colors #6099

Merged
merged 41 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
5f13e5f
Create the security event dashboard (#5892)
chantal-kelm Sep 19, 2023
db6cd29
Create the malware detection dashboard (#5899)
chantal-kelm Sep 22, 2023
cfc9d06
Create log data analysis dashboard (#5910)
chantal-kelm Sep 25, 2023
195c711
Update integrity monitoring dashboard (#5929)
chantal-kelm Sep 26, 2023
8638c32
Create incident response dashboard (#5934)
chantal-kelm Sep 29, 2023
c05c1ab
Update cloud security dashboard (#5943)
chantal-kelm Sep 29, 2023
e77a711
Update regulatory compliance dashboard (#5942)
chantal-kelm Sep 29, 2023
ccee315
Update containers security dashboard (#5944)
chantal-kelm Sep 29, 2023
22c3b99
Update dashboard security events
chantal-kelm Oct 19, 2023
65f1822
Implement the security event dashboard
chantal-kelm Oct 19, 2023
fcbe4de
Implement the fim, pci dashboards
chantal-kelm Oct 19, 2023
05ff087
Implement the aws dashboards
chantal-kelm Oct 19, 2023
4fcc5ef
Implement the docker dashboard
chantal-kelm Oct 19, 2023
e023993
policy monitoring update
chantal-kelm Oct 20, 2023
919d4f7
Update security configuration assessment dashboard (#5999)
chantal-kelm Oct 25, 2023
0c7aedd
update changelog and code clean
chantal-kelm Oct 26, 2023
03b5cbb
merge 4.8.0
chantal-kelm Oct 26, 2023
dc2ce07
Refactoring of the security configuration assessment (#6061)
chantal-kelm Oct 27, 2023
9134932
Change the display order of tabs in all modules (#6067)
chantal-kelm Oct 30, 2023
e76352e
change security events
chantal-kelm Oct 30, 2023
13b15a4
Remove new dashboards of integrity monitoring security events and ama…
chantal-kelm Oct 30, 2023
2b57d0d
Add graph to docker dashboard (#6075)
chantal-kelm Oct 30, 2023
eea2865
Merge branch '4.8.0' into 5818-Update-dashboards
chantal-kelm Oct 30, 2023
25126b5
Update top 5 policy monitoring
chantal-kelm Oct 30, 2023
2c4dd46
Update top 5 pci dss
chantal-kelm Oct 30, 2023
1bdf8ad
Remove new dashboard of PCI DSS (#6080)
chantal-kelm Oct 31, 2023
3a39fda
Merge branch '4.8.0' into 5818-Update-dashboards
chantal-kelm Nov 2, 2023
386bca9
fix colors in pci dashboard
chantal-kelm Nov 6, 2023
0123f26
merge with 4.8.0
chantal-kelm Nov 6, 2023
8fd1677
fix colors in security events dashboards
chantal-kelm Nov 6, 2023
dc41613
update
chantal-kelm Nov 6, 2023
e7c2bca
Fix colors in docker fim github hipaa nist aws gdpr mitre pm tsc viru…
chantal-kelm Nov 6, 2023
e41694d
change in fix colors security events
chantal-kelm Nov 7, 2023
f68e1f0
add change pci dashboard
chantal-kelm Nov 7, 2023
ea3fb2a
Merge branch '4.8.0' into 6095-Visualizations-with-different-colors
chantal-kelm Nov 7, 2023
7531e26
add changes in mitre dashboard
chantal-kelm Nov 7, 2023
b8974b9
Merge branch '4.8.0' of https://github.com/wazuh/wazuh-kibana-app int…
chantal-kelm Nov 7, 2023
f61e9b6
Merge branch '6095-Visualizations-with-different-colors' of https://g…
chantal-kelm Nov 7, 2023
236a227
Merge branch '4.8.0' into 6095-Visualizations-with-different-colors
chantal-kelm Nov 16, 2023
781e7df
Redefine mappedColors.mapKeys method
asteriscos Nov 21, 2023
fc6cf45
Fix comment
asteriscos Nov 21, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const agentVisualizations = {
height: 400,
vis: [
{
title: 'Alert groups evolution',
title: 'Top 10 Alert groups evolution',
id: 'Wazuh-App-Agents-General-Alert-groups-evolution',
width: 50,
},
Expand Down
8 changes: 4 additions & 4 deletions plugins/main/public/components/visualize/visualizations.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ export const visualizations = {
height: 360,
vis: [
{
title: 'Alert level evolution',
title: 'Top 10 Alert level evolution',
id: 'Wazuh-App-Overview-General-Alert-level-evolution',
width: 60,
},
{
title: 'Top MITRE ATT&CKS',
title: 'Top 10 MITRE ATT&CKS',
id: 'Wazuh-App-Overview-General-Alerts-Top-Mitre',
width: 40,
},
Expand Down Expand Up @@ -249,7 +249,7 @@ export const visualizations = {
height: 400,
vis: [
{
title: 'PCI DSS requirements',
title: 'Top 10 PCI DSS requirements',
id: 'Wazuh-App-Overview-PCI-DSS-requirements',
width: 50,
},
Expand Down Expand Up @@ -346,7 +346,7 @@ export const visualizations = {
width: 20,
},
{
title: 'Top requirements over time',
title: 'Top 10 requirements over time',
id: 'Wazuh-App-Overview-NIST-Requirements-over-time',
width: 50,
},
Expand Down
8 changes: 7 additions & 1 deletion plugins/main/public/components/visualize/wz-visualize.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { VisHandlers } from '../../factories/vis-handlers';
import { RawVisualizations } from '../../factories/raw-visualizations';
import { Metrics } from '../overview/metrics/metrics';
import { PatternHandler } from '../../react-services/pattern-handler';
import { getToasts } from '../../kibana-services';
import { getToasts, getPlugins } from '../../kibana-services';
import { SampleDataWarning, SecurityAlerts } from './components';
import { toMountPoint } from '../../../../../src/plugins/opensearch_dashboards_react/public';
import { withReduxProvider, withErrorBoundary } from '../common/hocs';
Expand All @@ -57,6 +57,12 @@ export const WzVisualize = compose(
refreshingKnownFields: [],
refreshingIndex: true,
};
// Reset the visualizations mapped colors when the type of Dashboard is changed.
// This is a workaround until the issue reported in Opensearch Dashboards is fixed.
// https://github.com/opensearch-project/OpenSearch-Dashboards/issues/5422
// This should be reomved when the issue is fixed. Probably in OSD 2.12.0
getPlugins().charts.colors.mappedColors.purge();

this.hasRefreshedKnownFields = false;
this.isRefreshing = false;
this.metricValues = false;
Expand Down
51 changes: 51 additions & 0 deletions plugins/main/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import {
} from './services/request-handler';
import { Applications, Categories } from './utils/applications';
import { syncHistoryLocations } from './kibana-integrations/discover/kibana_services';
import { euiPaletteColorBlind } from '@elastic/eui';

const innerAngularName = 'app/wazuh';

Expand All @@ -64,6 +65,56 @@ export class WazuhPlugin
console.error('plugin.ts: Error getting logos configuration', error);
}

// Redefine the mapKeys method to change the properties sent to euiPaletteColorBlind.
// This is a workaround until the issue reported in Opensearch Dashboards is fixed.
// https://github.com/opensearch-project/OpenSearch-Dashboards/issues/5422
// This should be reomved when the issue is fixed. Probably in OSD 2.12.0
plugins.charts.colors.mappedColors.mapKeys = function (
keys: Array<string | number>,
) {
const configMapping = this.getConfigColorMapping();
const configColors = _.values(configMapping);
const oldColors = _.values(this._oldMap);

let alreadyUsedColors: string[] = [];
const keysToMap: Array<string | number> = [];
_.each(keys, key => {
// If this key is mapped in the config, it's unnecessary to have it mapped here
if (configMapping[key as any]) {
delete this._mapping[key];
alreadyUsedColors.push(configMapping[key]);
}

// If this key is mapped to a color used by the config color mapping, we need to remap it
if (_.includes(configColors, this._mapping[key])) keysToMap.push(key);

// if key exist in oldMap, move it to mapping
if (this._oldMap[key]) {
this._mapping[key] = this._oldMap[key];
alreadyUsedColors.push(this._mapping[key]);
}

// If this key isn't mapped, we need to map it
if (this.get(key) == null) keysToMap.push(key);
});

alreadyUsedColors.push(...Object.values(this._mapping));
alreadyUsedColors = alreadyUsedColors.map(color =>
color.toLocaleLowerCase(),
);
// Choose colors from euiPaletteColorBlind and filter out any already assigned to keys
const colorPalette = euiPaletteColorBlind({
rotations: Math.ceil(
(keysToMap.length + alreadyUsedColors.length) / 10,
),
direction: core.uiSettings.get('theme:darkMode') ? 'darker' : 'lighter',
})
.filter(color => !alreadyUsedColors.includes(color.toLowerCase()))
.slice(0, keysToMap.length);

_.merge(this._mapping, _.zipObject(keysToMap, colorPalette));
};

// Register the applications
Applications.forEach(app => {
const { category, id, title, redirectTo, order } = app;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,21 @@ export default [
addLegend: true,
legendPosition: 'right',
isDonut: true,
labels: { show: false, values: true, last_level: true, truncate: 100 },
labels: {
show: false,
values: true,
last_level: true,
truncate: 100,
},
},
aggs: [
{ id: '1', enabled: true, type: 'count', schema: 'metric', params: {} },
{
id: '1',
enabled: true,
type: 'count',
schema: 'metric',
params: {},
},
{
id: '2',
enabled: true,
Expand Down Expand Up @@ -72,10 +83,21 @@ export default [
addLegend: true,
legendPosition: 'right',
isDonut: true,
labels: { show: false, values: true, last_level: true, truncate: 100 },
labels: {
show: false,
values: true,
last_level: true,
truncate: 100,
},
},
aggs: [
{ id: '1', enabled: true, type: 'count', schema: 'metric', params: {} },
{
id: '1',
enabled: true,
type: 'count',
schema: 'metric',
params: {},
},
{
id: '2',
enabled: true,
Expand Down Expand Up @@ -124,7 +146,13 @@ export default [
totalFunc: 'sum',
},
aggs: [
{ id: '1', enabled: true, type: 'count', schema: 'metric', params: {} },
{
id: '1',
enabled: true,
type: 'count',
schema: 'metric',
params: {},
},
{
id: '2',
enabled: true,
Expand Down Expand Up @@ -202,7 +230,11 @@ export default [
type: 'histogram',
params: {
type: 'histogram',
grid: { categoryLines: true, style: { color: '#eee' }, valueAxis: 'ValueAxis-1' },
grid: {
categoryLines: true,
style: { color: '#eee' },
valueAxis: 'ValueAxis-1',
},
categoryAxes: [
{
id: 'CategoryAxis-1',
Expand Down Expand Up @@ -246,23 +278,12 @@ export default [
addTimeMarker: false,
},
aggs: [
{ id: '1', enabled: true, type: 'count', schema: 'metric', params: {} },
{
id: '2',
id: '1',
enabled: true,
type: 'date_histogram',
schema: 'segment',
params: {
field: 'timestamp',
timeRange: { from: 'now-1h', to: 'now', mode: 'quick' },
useNormalizedEsInterval: true,
interval: 'auto',
time_zone: 'Europe/Berlin',
drop_partials: false,
customInterval: '2h',
min_doc_count: 1,
extended_bounds: {},
},
type: 'count',
schema: 'metric',
params: {},
},
{
id: '3',
Expand All @@ -280,6 +301,23 @@ export default [
missingBucketLabel: 'Missing',
},
},
{
id: '2',
enabled: true,
type: 'date_histogram',
schema: 'segment',
params: {
field: 'timestamp',
timeRange: { from: 'now-1h', to: 'now', mode: 'quick' },
useNormalizedEsInterval: true,
interval: 'auto',
time_zone: 'Europe/Berlin',
drop_partials: false,
customInterval: '2h',
min_doc_count: 1,
extended_bounds: {},
},
},
],
}),
uiStateJSON: '{}',
Expand All @@ -304,7 +342,11 @@ export default [
type: 'area',
params: {
type: 'area',
grid: { categoryLines: true, style: { color: '#eee' }, valueAxis: 'ValueAxis-1' },
grid: {
categoryLines: true,
style: { color: '#eee' },
valueAxis: 'ValueAxis-1',
},
categoryAxes: [
{
id: 'CategoryAxis-1',
Expand Down Expand Up @@ -356,6 +398,23 @@ export default [
schema: 'metric',
params: { customLabel: 'Events' },
},
{
id: '3',
enabled: true,
type: 'terms',
schema: 'group',
params: {
field: 'data.docker.Action',
size: 10,
order: 'desc',
orderBy: '1',
otherBucket: false,
otherBucketLabel: 'Other',
missingBucket: false,
missingBucketLabel: 'Missing',
customLabel: 'Action',
},
},
{
id: '2',
enabled: true,
Expand All @@ -374,23 +433,6 @@ export default [
customLabel: '',
},
},
{
id: '3',
enabled: true,
type: 'terms',
schema: 'group',
params: {
field: 'data.docker.Action',
size: 10,
order: 'desc',
orderBy: '1',
otherBucket: false,
otherBucketLabel: 'Other',
missingBucket: false,
missingBucketLabel: 'Missing',
customLabel: 'Action',
},
},
],
}),
uiStateJSON: '{}',
Expand Down
Loading
Loading