From 5b063ee172bc070a35fb9f5fe33796b4f8309405 Mon Sep 17 00:00:00 2001 From: JuanGarriuz Date: Thu, 4 Apr 2024 13:25:11 +0200 Subject: [PATCH 01/17] Added tab --- .../configuration/logcollector-localfile.json | 132 +++++++++--------- .../log-collection/log-collection-journald.js | 128 +++++++++++++++++ .../log-collection/log-collection.js | 13 ++ .../configuration/log-collection/types.js | 1 + 4 files changed, 211 insertions(+), 63 deletions(-) create mode 100644 plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js diff --git a/docker/imposter/agents/configuration/logcollector-localfile.json b/docker/imposter/agents/configuration/logcollector-localfile.json index c61d46743d..2c47248b9d 100644 --- a/docker/imposter/agents/configuration/logcollector-localfile.json +++ b/docker/imposter/agents/configuration/logcollector-localfile.json @@ -1,31 +1,71 @@ { "data": { "localfile": [ + { + "logformat": "journald", + "ignore_binaries": "no", + "only-future-events": "no", + "target": ["agent"], + "filters": [ + [ + { + "field": "_KERNEL_DEVICE", + "expression": ".", + "ignore_if_missing": false + } + ], + [ + { + "field": "_SYSTEMD_UNIT", + "expression": "^cron.service$", + "ignore_if_missing": false + }, + { + "field": "CUSTOM", + "expression": "0|1|2", + "ignore_if_missing": true + } + ] + ], + "filters_disabled": false + }, + { + "logformat": "journald", + "ignore_binaries": "no", + "only-future-events": "yes", + "target": ["agent"] + }, + { + "logformat": "journald", + "ignore_binaries": "no", + "only-future-events": "yes", + "target": ["agent"], + "filters": [ + { + "field": "_KERNEL_DEVICE", + "expression": ".", + "ignore_if_missing": false + } + ], + "filters_disabled": false + }, { "logformat": "macos", "query": { "value": "(process == \"sudo\") or (process == \"sessionlogoutd\" and message contains \"logout is complete.\") or (process == \"sshd\") or (process == \"tccd\" and message contains \"Update Access Record\") or (message contains \"SessionAgentNotificationCenter\") or (process == \"screensharingd\" and message contains \"Authentication\") or (process == \"securityd\" and eventMessage contains \"Session\" and subsystem == \"com.apple.securityd\")", "level": "info", - "type": [ - "log", - "activity", - "trace" - ] + "type": ["log", "activity", "trace"] }, "ignore_binaries": "no", "only-future-events": "yes", - "target": [ - "agent" - ] + "target": ["agent"] }, { "logformat": "command", "command": "df -P", "alias": "df -P", "ignore_binaries": "no", - "target": [ - "agent" - ], + "target": ["agent"], "frequency": 360 }, { @@ -33,9 +73,7 @@ "command": "netstat -tulpn | sed 's/\\([[:alnum:]]\\+\\)\\ \\+[[:digit:]]\\+\\ \\+[[:digit:]]\\+\\ \\+\\(.*\\):\\([[:digit:]]*\\)\\ \\+\\([0-9\\.\\:\\*]\\+\\).\\+\\ \\([[:digit:]]*\\/[[:alnum:]\\-]*\\).*/\\1 \\2 == \\3 == \\4 \\5/' | sort -k 4 -g | sed 's/ == \\(.*\\) ==/:\\1/' | sed 1,2d", "alias": "netstat listening ports", "ignore_binaries": "no", - "target": [ - "agent" - ], + "target": ["agent"], "frequency": 360 }, { @@ -43,9 +81,7 @@ "command": "last -n 20", "alias": "last -n 20", "ignore_binaries": "no", - "target": [ - "agent" - ], + "target": ["agent"], "frequency": 360 }, { @@ -53,80 +89,62 @@ "logformat": "syslog", "ignore_binaries": "no", "only-future-events": "yes", - "target": [ - "agent" - ] + "target": ["agent"] }, { "file": "/var/log/nginx/access.log", "logformat": "apache", "ignore_binaries": "no", "only-future-events": "yes", - "target": [ - "agent" - ] + "target": ["agent"] }, { "file": "/var/log/nginx/error.log", "logformat": "apache", "ignore_binaries": "no", "only-future-events": "yes", - "target": [ - "agent" - ] + "target": ["agent"] }, { "file": "/var/ossec/logs/active-responses.log", "logformat": "syslog", "ignore_binaries": "no", "only-future-events": "yes", - "target": [ - "agent" - ] + "target": ["agent"] }, { "file": "/var/log/auth.log", "logformat": "syslog", "ignore_binaries": "no", "only-future-events": "yes", - "target": [ - "agent" - ] + "target": ["agent"] }, { "file": "/var/log/syslog", "logformat": "syslog", "ignore_binaries": "no", "only-future-events": "yes", - "target": [ - "agent" - ] + "target": ["agent"] }, { "file": "/var/log/dpkg.log", "logformat": "syslog", "ignore_binaries": "no", "only-future-events": "yes", - "target": [ - "agent" - ] + "target": ["agent"] }, { "file": "/var/log/kern.log", "logformat": "syslog", "ignore_binaries": "no", "only-future-events": "yes", - "target": [ - "agent" - ] + "target": ["agent"] }, { "channel": "Application", "logformat": "eventlog", "ignore_binaries": "no", - "target": [ - "agent" - ] + "target": ["agent"] }, { "channel": "Security", @@ -136,36 +154,28 @@ }, "ignore_binaries": "no", "only-future-events": "yes", - "target": [ - "agent" - ], + "target": ["agent"], "reconnect_time": 5 }, { "channel": "System", "logformat": "eventlog", "ignore_binaries": "no", - "target": [ - "agent" - ] + "target": ["agent"] }, { "file": "active-response\\active-responses.log", "logformat": "syslog", "ignore_binaries": "no", "only-future-events": "yes", - "target": [ - "agent" - ] + "target": ["agent"] }, { "channel": "Microsoft-Windows-Sysmon/Operational", "logformat": "eventchannel", "ignore_binaries": "no", "only-future-events": "yes", - "target": [ - "agent" - ], + "target": ["agent"], "reconnect_time": 5 }, { @@ -173,9 +183,7 @@ "logformat": "eventchannel", "ignore_binaries": "no", "only-future-events": "yes", - "target": [ - "agent" - ], + "target": ["agent"], "reconnect_time": 5 }, { @@ -183,11 +191,9 @@ "logformat": "iis", "ignore_binaries": "no", "only-future-events": "yes", - "target": [ - "agent" - ] + "target": ["agent"] } ] }, "error": 0 -} \ No newline at end of file +} diff --git a/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js b/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js new file mode 100644 index 0000000000..f58f2ffb34 --- /dev/null +++ b/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js @@ -0,0 +1,128 @@ +/* + * Wazuh app - React component for show configuration of log collection - commands tab. + * Copyright (C) 2015-2022 Wazuh, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Find more information about this on the LICENSE file. + */ + +import React, { Component, Fragment } from 'react'; + +import WzNoConfig from '../util-components/no-config'; +import WzConfigurationSettingsHeader from '../util-components/configuration-settings-header'; +import WzConfigurationListSelector from '../util-components/configuration-settings-list-selector'; +import WzConfigurationSettingsGroup from '../util-components/configuration-settings-group'; +import { renderValueOrNoValue, isString } from '../utils/utils'; +import { settingsListBuilder } from '../utils/builders'; +import helpLinks from './help-links'; +import { + LOGCOLLECTOR_LOCALFILE_PROP, + LOCALFILE_MACOSEVENT_PROP, +} from './types'; + +/** + * + * @param {*} data => all log data + * @returns string => value to show in query input + */ +const queryValue = data => { + return typeof data === 'undefined' + ? '-' + : typeof data === 'object' + ? data.value + : data; +}; + +/** + * Returns targets array parsed in one string + * @param {*} item + * @returns string => target + */ +const renderTargetField = item => + Array.isArray(item) ? item.join(', ') : 'agent'; + +/** + * Return panels title + * @param {*} item => log data + * @returns + */ +const panelsLabel = item => + `${item.logformat} - ${renderTargetField(item.target)}`; + +const mainSettings = [ + { field: 'logformat', label: 'Log format' }, + { field: 'query', label: 'Query value', render: queryValue }, + { field: 'query.level', label: 'Query level', render: renderValueOrNoValue }, + { field: 'query.type', label: 'Query type', render: renderValueOrNoValue }, + { + field: 'ignore_binaries', + label: 'Ignore binaries', + render: renderValueOrNoValue, + }, + { + field: 'only-future-events', + label: 'Only future events', + render: renderValueOrNoValue, + }, +]; + +class WzConfigurationLogCollectionJournald extends Component { + constructor(props) { + super(props); + } + render() { + const { currentConfig } = this.props; + const items = currentConfig?.[LOGCOLLECTOR_LOCALFILE_PROP]?.[ + LOCALFILE_MACOSEVENT_PROP + ] + ? settingsListBuilder( + currentConfig[LOGCOLLECTOR_LOCALFILE_PROP][LOCALFILE_MACOSEVENT_PROP], + panelsLabel, + ) + : []; + + return ( + + {isString(currentConfig?.[LOGCOLLECTOR_LOCALFILE_PROP]) && ( + + )} + {!currentConfig?.[LOGCOLLECTOR_LOCALFILE_PROP]?.[ + LOCALFILE_MACOSEVENT_PROP + ]?.length ? ( + + ) : null} + {currentConfig?.[LOGCOLLECTOR_LOCALFILE_PROP]?.[ + LOCALFILE_MACOSEVENT_PROP + ]?.length > 1 ? ( + + + + ) : null} + {currentConfig?.[LOGCOLLECTOR_LOCALFILE_PROP]?.[ + LOCALFILE_MACOSEVENT_PROP + ]?.length === 1 ? ( + + ) : null} + + ); + } +} + +export default WzConfigurationLogCollectionJournald; diff --git a/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection.js b/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection.js index 52c0ee029a..9a308fc0c5 100644 --- a/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection.js +++ b/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection.js @@ -20,6 +20,7 @@ import WzConfigurationLogCollectionCommands from './log-collection-commands'; import WzConfigurationLogCollectionWindowsEvents from './log-collection-windowsevents'; import WzConfigurationLogCollectionMacOSEvents from './log-collection-macosevents'; import WzConfigurationLogCollectionSockets from './log-collection-sockets'; +import WzConfigurationLogCollectionJournald from './log-collection-journald'; import withWzConfig from '../util-hocs/wz-config'; import { isString } from '../utils/utils'; import { @@ -28,6 +29,7 @@ import { LOCALFILE_WINDOWSEVENT_PROP, LOGCOLLECTOR_LOCALFILE_PROP, LOCALFILE_MACOSEVENT_PROP, + LOCALFILE_JOURNALDT_PROP, } from './types'; class WzConfigurationLogCollection extends Component { @@ -136,6 +138,17 @@ class WzConfigurationLogCollection extends Component { ), }, + { + condition: true, // Will always render + component: ( + + + + ), + }, ]; return ( diff --git a/plugins/main/public/controllers/management/components/management/configuration/log-collection/types.js b/plugins/main/public/controllers/management/components/management/configuration/log-collection/types.js index 57d22b9412..b7a4c7a1ea 100644 --- a/plugins/main/public/controllers/management/components/management/configuration/log-collection/types.js +++ b/plugins/main/public/controllers/management/components/management/configuration/log-collection/types.js @@ -5,3 +5,4 @@ export const LOCALFILE_LOGS_PROP = 'localfile-logs'; export const LOCALFILE_WINDOWSEVENT_PROP = 'localfile-windowsevent'; export const LOCALFILE_COMMANDS_PROP = 'localfile-commands'; export const LOCALFILE_MACOSEVENT_PROP = 'localfile-macosevent'; +export const LOCALFILE_JOURNALDT_PROP = 'localfile-journald'; From 93fe5ba0979a03fb52f2592003ced7826b75c080 Mon Sep 17 00:00:00 2001 From: JuanGarriuz Date: Mon, 8 Apr 2024 13:19:46 +0200 Subject: [PATCH 02/17] Add journald tab --- .../log-collection/log-collection-journald.js | 23 ++++++++----------- .../log-collection/log-collection.js | 3 +++ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js b/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js index f58f2ffb34..51d64b357d 100644 --- a/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js +++ b/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js @@ -19,10 +19,7 @@ import WzConfigurationSettingsGroup from '../util-components/configuration-setti import { renderValueOrNoValue, isString } from '../utils/utils'; import { settingsListBuilder } from '../utils/builders'; import helpLinks from './help-links'; -import { - LOGCOLLECTOR_LOCALFILE_PROP, - LOCALFILE_MACOSEVENT_PROP, -} from './types'; +import { LOGCOLLECTOR_LOCALFILE_PROP, LOCALFILE_JOURNALDT_PROP } from './types'; /** * @@ -54,10 +51,10 @@ const panelsLabel = item => `${item.logformat} - ${renderTargetField(item.target)}`; const mainSettings = [ - { field: 'logformat', label: 'Log format' }, - { field: 'query', label: 'Query value', render: queryValue }, - { field: 'query.level', label: 'Query level', render: renderValueOrNoValue }, - { field: 'query.type', label: 'Query type', render: renderValueOrNoValue }, + { field: 'journald', label: 'Log format' }, + { field: 'journald', label: 'Location' }, + { field: 'query.level', label: 'Query level' }, + { field: 'query.type', label: 'Query type' }, { field: 'ignore_binaries', label: 'Ignore binaries', @@ -77,10 +74,10 @@ class WzConfigurationLogCollectionJournald extends Component { render() { const { currentConfig } = this.props; const items = currentConfig?.[LOGCOLLECTOR_LOCALFILE_PROP]?.[ - LOCALFILE_MACOSEVENT_PROP + LOCALFILE_JOURNALDT_PROP ] ? settingsListBuilder( - currentConfig[LOGCOLLECTOR_LOCALFILE_PROP][LOCALFILE_MACOSEVENT_PROP], + currentConfig[LOGCOLLECTOR_LOCALFILE_PROP][LOCALFILE_JOURNALDT_PROP], panelsLabel, ) : []; @@ -94,12 +91,12 @@ class WzConfigurationLogCollectionJournald extends Component { /> )} {!currentConfig?.[LOGCOLLECTOR_LOCALFILE_PROP]?.[ - LOCALFILE_MACOSEVENT_PROP + LOCALFILE_JOURNALDT_PROP ]?.length ? ( ) : null} {currentConfig?.[LOGCOLLECTOR_LOCALFILE_PROP]?.[ - LOCALFILE_MACOSEVENT_PROP + LOCALFILE_JOURNALDT_PROP ]?.length > 1 ? ( ) : null} {currentConfig?.[LOGCOLLECTOR_LOCALFILE_PROP]?.[ - LOCALFILE_MACOSEVENT_PROP + LOCALFILE_JOURNALDT_PROP ]?.length === 1 ? ( item.logformat === 'macos'), + [LOCALFILE_JOURNALDT_PROP]: currentConfig[ + LOGCOLLECTOR_LOCALFILE_PROP + ].localfile.filter(item => item.logformat === 'journald'), [LOCALFILE_COMMANDS_PROP]: currentConfig[ LOGCOLLECTOR_LOCALFILE_PROP ].localfile.filter( From 8eb8d187fce1dfb67bf28fa3696f9d4671b161d0 Mon Sep 17 00:00:00 2001 From: JuanGarriuz Date: Wed, 10 Apr 2024 10:35:28 +0200 Subject: [PATCH 03/17] Added changes to imposter --- .../configuration/logcollector-localfile.json | 8 ++++---- .../log-collection/log-collection-journald.js | 17 +++++++++++++---- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/docker/imposter/agents/configuration/logcollector-localfile.json b/docker/imposter/agents/configuration/logcollector-localfile.json index 2c47248b9d..a9f45d284f 100644 --- a/docker/imposter/agents/configuration/logcollector-localfile.json +++ b/docker/imposter/agents/configuration/logcollector-localfile.json @@ -5,12 +5,12 @@ "logformat": "journald", "ignore_binaries": "no", "only-future-events": "no", - "target": ["agent"], + "target": ["agent1"], "filters": [ [ { "field": "_KERNEL_DEVICE", - "expression": ".", + "expression": ".kernel1", "ignore_if_missing": false } ], @@ -33,13 +33,13 @@ "logformat": "journald", "ignore_binaries": "no", "only-future-events": "yes", - "target": ["agent"] + "target": ["agent2"] }, { "logformat": "journald", "ignore_binaries": "no", "only-future-events": "yes", - "target": ["agent"], + "target": ["agent3"], "filters": [ { "field": "_KERNEL_DEVICE", diff --git a/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js b/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js index 51d64b357d..3da8dc6406 100644 --- a/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js +++ b/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js @@ -51,10 +51,7 @@ const panelsLabel = item => `${item.logformat} - ${renderTargetField(item.target)}`; const mainSettings = [ - { field: 'journald', label: 'Log format' }, - { field: 'journald', label: 'Location' }, - { field: 'query.level', label: 'Query level' }, - { field: 'query.type', label: 'Query type' }, + { field: 'logformat', label: 'Log format' }, { field: 'ignore_binaries', label: 'Ignore binaries', @@ -65,6 +62,18 @@ const mainSettings = [ label: 'Only future events', render: renderValueOrNoValue, }, + { + field: 'filters', + label: 'Kernel device', + }, + { + field: 'filters', + label: 'SYSTEMD UNIT', + }, + { + field: 'filters', + label: 'CUSTOM', + }, ]; class WzConfigurationLogCollectionJournald extends Component { From c646d5685fc775b08f661aa8ecc73a0dfa769113 Mon Sep 17 00:00:00 2001 From: JuanGarriuz Date: Wed, 10 Apr 2024 15:47:18 +0200 Subject: [PATCH 04/17] journald values filters table --- .../log-collection/log-collection-journald.js | 9 ------- .../util-components/configuration-setting.js | 27 +++++++++++++++---- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js b/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js index 3da8dc6406..d68dc786b2 100644 --- a/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js +++ b/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js @@ -64,15 +64,6 @@ const mainSettings = [ }, { field: 'filters', - label: 'Kernel device', - }, - { - field: 'filters', - label: 'SYSTEMD UNIT', - }, - { - field: 'filters', - label: 'CUSTOM', }, ]; diff --git a/plugins/main/public/controllers/management/components/management/configuration/util-components/configuration-setting.js b/plugins/main/public/controllers/management/components/management/configuration/util-components/configuration-setting.js index c19d56819f..85da49b6f9 100644 --- a/plugins/main/public/controllers/management/components/management/configuration/util-components/configuration-setting.js +++ b/plugins/main/public/controllers/management/components/management/configuration/util-components/configuration-setting.js @@ -12,8 +12,9 @@ import React, { Component, Fragment } from 'react'; import PropTypes from 'prop-types'; - +import { EuiBasicTable } from '@elastic/eui'; import { EuiFieldText, EuiSpacer, EuiTextAlign } from '@elastic/eui'; +import WzConfigurationSettingsHeader from '../util-components/configuration-settings-header'; class WzConfigurationSetting extends Component { constructor(props) { @@ -53,10 +54,12 @@ class WzConfigurationSetting extends Component { : { justifySelf: 'flex-end', margin: '1em', width: '35%' } } > - {label} + + {label} +
- {Array.isArray(value) ? ( + {Array.isArray(value) && typeof value[0] === 'string' ? (
    {value.map((v, key) => (
  • @@ -64,16 +67,30 @@ class WzConfigurationSetting extends Component {
  • ))}
+ ) : Array.isArray(value) ? ( + + + + ) : ( )}
- + ) : null; } From b3cfa1c7e8534475419e18c2d98ca16a60a9d726 Mon Sep 17 00:00:00 2001 From: JuanGarriuz Date: Thu, 11 Apr 2024 12:28:07 +0200 Subject: [PATCH 05/17] Update changelog and redesign filters table --- CHANGELOG.md | 4 +-- .../log-collection/log-collection-journald.js | 17 ++---------- .../util-components/configuration-setting.js | 26 ++++++++++++++++--- 3 files changed, 26 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8af13b6b71..0a75209008 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,8 +14,8 @@ All notable changes to the Wazuh app project will be documented in this file. - Added propagation of updates from the table to dashboard visualizations in Endpoints summary [#6460](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6460) - Handle index pattern selector on new discover [#6499](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6499) - Added macOS log collector tab [#6545](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6545) - -### Changed +- Added journald log collector tab [#6572](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6572) + ### Changed - Removed embedded discover [#6120](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6120) [#6235](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6235) [#6254](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6254) [#6285](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6285) [#6288](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6288) [#6290](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6290) [#6289](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6289) [#6286](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6286) [#6275](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6275) [#6287](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6297](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6297) [#6287](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6291](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6459](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6459) [#6434](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6434) - Develop logic of a new index for the fim module [#6227](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6227) diff --git a/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js b/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js index d68dc786b2..fbb0ce9957 100644 --- a/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js +++ b/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js @@ -21,19 +21,6 @@ import { settingsListBuilder } from '../utils/builders'; import helpLinks from './help-links'; import { LOGCOLLECTOR_LOCALFILE_PROP, LOCALFILE_JOURNALDT_PROP } from './types'; -/** - * - * @param {*} data => all log data - * @returns string => value to show in query input - */ -const queryValue = data => { - return typeof data === 'undefined' - ? '-' - : typeof data === 'object' - ? data.value - : data; -}; - /** * Returns targets array parsed in one string * @param {*} item @@ -99,8 +86,8 @@ class WzConfigurationLogCollectionJournald extends Component { LOCALFILE_JOURNALDT_PROP ]?.length > 1 ? ( -
+
{Array.isArray(value) && typeof value[0] === 'string' ? (
    {value.map((v, key) => ( @@ -69,13 +77,23 @@ class WzConfigurationSetting extends Component {
) : Array.isArray(value) ? ( + From 004cb3c4cddba605e19f6c85668a776c1c9997e1 Mon Sep 17 00:00:00 2001 From: JuanGarriuz Date: Thu, 11 Apr 2024 13:05:30 +0200 Subject: [PATCH 06/17] Fixed styles --- .../log-collection/log-collection-journald.js | 1 + .../util-components/configuration-setting.js | 35 ++++++++++--------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js b/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js index fbb0ce9957..fc1026ace6 100644 --- a/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js +++ b/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js @@ -49,6 +49,7 @@ const mainSettings = [ label: 'Only future events', render: renderValueOrNoValue, }, + { field: 'filters_disabled', label: 'Filters Disabled' }, { field: 'filters', }, diff --git a/plugins/main/public/controllers/management/components/management/configuration/util-components/configuration-setting.js b/plugins/main/public/controllers/management/components/management/configuration/util-components/configuration-setting.js index c34ca8224e..248db6cc79 100644 --- a/plugins/main/public/controllers/management/components/management/configuration/util-components/configuration-setting.js +++ b/plugins/main/public/controllers/management/components/management/configuration/util-components/configuration-setting.js @@ -47,24 +47,25 @@ class WzConfigurationSetting extends Component { flexDirection: isMobile ? 'column' : 'row', }} > + {!label ? ( + [] + ) : ( +
+ + {label} + +
+ )} +
- - {label} - -
-
{Array.isArray(value) && typeof value[0] === 'string' ? ( @@ -75,7 +76,7 @@ class WzConfigurationSetting extends Component { ))} - ) : Array.isArray(value) ? ( + ) : Array.isArray(value) && typeof value[0] === 'object' ? ( From 51b39adf19b05fc7c3cc69068d6032d249ee8759 Mon Sep 17 00:00:00 2001 From: JuanGarriuz Date: Fri, 12 Apr 2024 13:08:40 +0200 Subject: [PATCH 07/17] Fixed hardcode bug --- .../log-collection/log-collection-journald.js | 19 ++++++++++ .../util-components/configuration-setting.js | 38 ++++++------------- .../configuration-settings-group.js | 27 +++---------- 3 files changed, 36 insertions(+), 48 deletions(-) diff --git a/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js b/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js index fc1026ace6..27cae50f64 100644 --- a/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js +++ b/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js @@ -52,6 +52,25 @@ const mainSettings = [ { field: 'filters_disabled', label: 'Filters Disabled' }, { field: 'filters', + label: 'Filters', + name: 'Filters', + render: value => { + if (Array.isArray(value)) return value.flat(); + }, + columns: [ + { + field: 'field', + name: 'Field', + }, + { + field: 'expression', + name: 'Expression', + }, + { + field: 'ignore_if_missing', + name: 'Ignore If Missing', + }, + ], }, ]; diff --git a/plugins/main/public/controllers/management/components/management/configuration/util-components/configuration-setting.js b/plugins/main/public/controllers/management/components/management/configuration/util-components/configuration-setting.js index 248db6cc79..a52f2740c9 100644 --- a/plugins/main/public/controllers/management/components/management/configuration/util-components/configuration-setting.js +++ b/plugins/main/public/controllers/management/components/management/configuration/util-components/configuration-setting.js @@ -10,7 +10,7 @@ * Find more information about this on the LICENSE file. */ -import React, { Component, Fragment } from 'react'; +import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { EuiBasicTable } from '@elastic/eui'; import { EuiFieldText, EuiSpacer, EuiTextAlign } from '@elastic/eui'; @@ -37,9 +37,9 @@ class WzConfigurationSetting extends Component { } render() { const { isMobile } = this.state; - const { keyItem, label, value } = this.props; + const { keyItem, label, value, columns } = this.props; return value || typeof value === 'number' || typeof value === 'boolean' ? ( - + <>
- {!label ? ( + {columns ? ( [] ) : (
{Array.isArray(value) && typeof value[0] === 'string' ? ( @@ -76,28 +76,12 @@ class WzConfigurationSetting extends Component { ))} - ) : Array.isArray(value) && typeof value[0] === 'object' ? ( - + ) : Array.isArray(value) && columns ? ( + <> - - - + + + ) : (
- + ) : null; } } diff --git a/plugins/main/public/controllers/management/components/management/configuration/util-components/configuration-settings-group.js b/plugins/main/public/controllers/management/components/management/configuration/util-components/configuration-settings-group.js index 37fa2ef33b..2d3347451e 100644 --- a/plugins/main/public/controllers/management/components/management/configuration/util-components/configuration-settings-group.js +++ b/plugins/main/public/controllers/management/components/management/configuration/util-components/configuration-settings-group.js @@ -13,13 +13,7 @@ import React, { Component, Fragment } from 'react'; import PropTypes from 'prop-types'; import { get } from 'lodash'; - -import { - EuiFlexGroup, - EuiFlexItem, - EuiSpacer, -} from '@elastic/eui'; - +import { EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui'; import WzConfigurationSetting from './configuration-setting'; import WzConfigurationSettingsHeader from './configuration-settings-header'; @@ -28,13 +22,7 @@ class WzSettingsGroup extends Component { super(props); } render() { - const { - config, - description, - items, - help, - title - } = this.props; + const { config, description, items, help, title } = this.props; return ( - + {items.map((item, key) => { @@ -59,11 +47,8 @@ class WzSettingsGroup extends Component { ? item.renderLabel(value, item, config) : item.label } - value={ - item.render - ? item.render(value) - : value - } + value={item.render ? item.render(value) : value} + columns={item.columns} /> ); })} @@ -76,7 +61,7 @@ class WzSettingsGroup extends Component { WzSettingsGroup.propTypes = { ...WzConfigurationSettingsHeader.propTypes, - items: PropTypes.array.isRequired + items: PropTypes.array.isRequired, }; export default WzSettingsGroup; From 13f5412f3d78c30819a699459eac670aa011d647 Mon Sep 17 00:00:00 2001 From: JuanGarriuz Date: Wed, 17 Apr 2024 13:04:09 +0200 Subject: [PATCH 08/17] Added filters groups --- .../log-collection/log-collection-journald.js | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js b/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js index 27cae50f64..342c1e25aa 100644 --- a/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js +++ b/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js @@ -39,11 +39,6 @@ const panelsLabel = item => const mainSettings = [ { field: 'logformat', label: 'Log format' }, - { - field: 'ignore_binaries', - label: 'Ignore binaries', - render: renderValueOrNoValue, - }, { field: 'only-future-events', label: 'Only future events', @@ -53,11 +48,23 @@ const mainSettings = [ { field: 'filters', label: 'Filters', - name: 'Filters', render: value => { - if (Array.isArray(value)) return value.flat(); + if (Array.isArray(value)) { + const flatArray = value.flat(); + const groupedFilters = flatArray.map((filter, index) => { + return { + ...filter, + filters_group: `Group ${Math.floor(index / value.length) + 1}`, + }; + }); + return groupedFilters; + } }, columns: [ + { + field: 'filters_group', + name: 'Filters Group', + }, { field: 'field', name: 'Field', From dc486d1fa13e087e5f2cdb8688910c900bcca228 Mon Sep 17 00:00:00 2001 From: JuanGarriuz Date: Thu, 18 Apr 2024 13:21:12 +0200 Subject: [PATCH 09/17] Change to an accordion render --- .../log-collection/log-collection-journald.js | 28 +++++--------- .../util-components/configuration-setting.js | 37 ++++++++++++++++-- .../configuration-settings-header.js | 31 +++++++-------- .../util-components/help-button-popover.js | 38 ++++++++++++------- 4 files changed, 80 insertions(+), 54 deletions(-) diff --git a/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js b/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js index 342c1e25aa..29ec783f88 100644 --- a/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js +++ b/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js @@ -16,7 +16,11 @@ import WzNoConfig from '../util-components/no-config'; import WzConfigurationSettingsHeader from '../util-components/configuration-settings-header'; import WzConfigurationListSelector from '../util-components/configuration-settings-list-selector'; import WzConfigurationSettingsGroup from '../util-components/configuration-settings-group'; -import { renderValueOrNoValue, isString } from '../utils/utils'; +import { + renderValueOrNoValue, + isString, + renderValueOrDefault, +} from '../utils/utils'; import { settingsListBuilder } from '../utils/builders'; import helpLinks from './help-links'; import { LOGCOLLECTOR_LOCALFILE_PROP, LOCALFILE_JOURNALDT_PROP } from './types'; @@ -44,27 +48,15 @@ const mainSettings = [ label: 'Only future events', render: renderValueOrNoValue, }, - { field: 'filters_disabled', label: 'Filters Disabled' }, + { + field: 'filters_disabled', + label: 'Filters Disabled', + render: renderValueOrDefault('true'), + }, { field: 'filters', label: 'Filters', - render: value => { - if (Array.isArray(value)) { - const flatArray = value.flat(); - const groupedFilters = flatArray.map((filter, index) => { - return { - ...filter, - filters_group: `Group ${Math.floor(index / value.length) + 1}`, - }; - }); - return groupedFilters; - } - }, columns: [ - { - field: 'filters_group', - name: 'Filters Group', - }, { field: 'field', name: 'Field', diff --git a/plugins/main/public/controllers/management/components/management/configuration/util-components/configuration-setting.js b/plugins/main/public/controllers/management/components/management/configuration/util-components/configuration-setting.js index a52f2740c9..3f1ad0aac4 100644 --- a/plugins/main/public/controllers/management/components/management/configuration/util-components/configuration-setting.js +++ b/plugins/main/public/controllers/management/components/management/configuration/util-components/configuration-setting.js @@ -12,9 +12,11 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; -import { EuiBasicTable } from '@elastic/eui'; +import { EuiAccordion, EuiBasicTable } from '@elastic/eui'; import { EuiFieldText, EuiSpacer, EuiTextAlign } from '@elastic/eui'; import WzConfigurationSettingsHeader from '../util-components/configuration-settings-header'; +import { webDocumentationLink } from '../../../../../../../common/services/web_documentation'; +import helpLinks from '../log-collection/help-links'; class WzConfigurationSetting extends Component { constructor(props) { @@ -78,9 +80,36 @@ class WzConfigurationSetting extends Component { ) : Array.isArray(value) && columns ? ( <> - - - + + {value.map((group, groupIndex) => ( + +
+ {Array.isArray(group) ? ( + + ) : ( + + )} +
+
+ ))} ) : ( - + - +

{title}

- {description && {description}} + {description && {description}}
- {help && ( + {(help || info) && ( - + )}
- + {title && ( - + )} {children}
@@ -70,7 +65,7 @@ class WzConfigurationSettingsHeader extends Component { WzConfigurationSettingsHeader.propTypes = { title: PropTypes.string, - description: PropTypes.string + description: PropTypes.string, }; export default WzConfigurationSettingsHeader; diff --git a/plugins/main/public/controllers/management/components/management/configuration/util-components/help-button-popover.js b/plugins/main/public/controllers/management/components/management/configuration/util-components/help-button-popover.js index ed2451cbd8..9ffdd888d0 100644 --- a/plugins/main/public/controllers/management/components/management/configuration/util-components/help-button-popover.js +++ b/plugins/main/public/controllers/management/components/management/configuration/util-components/help-button-popover.js @@ -19,7 +19,7 @@ class WzHelpButtonPopover extends Component { constructor(props) { super(props); this.state = { - showHelp: false + showHelp: false, }; } toggleShowHelp() { @@ -27,14 +27,14 @@ class WzHelpButtonPopover extends Component { } render() { const { showHelp } = this.state; - const { children, links } = this.props; + const { children, links, info } = this.props; return ( this.toggleShowHelp()} /> } @@ -42,16 +42,26 @@ class WzHelpButtonPopover extends Component { closePopover={() => this.toggleShowHelp()} >
- + More info about this section - {links.map(link => ( -
- - {link.text} - -
- ))} + {links ? ( + links.map(link => ( +
+ + {link.text} + +
+ )) + ) : info ? ( + {info} + ) : ( + JJAJAJ + )}
); @@ -59,7 +69,7 @@ class WzHelpButtonPopover extends Component { } WzHelpButtonPopover.propTypes = { - links: PropTypes.array + links: PropTypes.array, }; export default WzHelpButtonPopover; From 0863394053f80c5f2d92a8a080515899e4807195 Mon Sep 17 00:00:00 2001 From: JuanGarriuz Date: Thu, 18 Apr 2024 14:05:05 +0200 Subject: [PATCH 10/17] Added helps-link --- .../log-collection/log-collection-journald.js | 1 + .../util-components/configuration-setting.js | 8 +++---- .../configuration-settings-group.js | 1 + .../util-components/help-button-popover.js | 23 +++++++++++++++---- 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js b/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js index 29ec783f88..abea3441b8 100644 --- a/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js +++ b/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js @@ -70,6 +70,7 @@ const mainSettings = [ name: 'Ignore If Missing', }, ], + info: 'The configuration filters within the same group are processed with an AND logic operator. Whereas the different filter groups are processed with an OR like logic operator.', }, ]; diff --git a/plugins/main/public/controllers/management/components/management/configuration/util-components/configuration-setting.js b/plugins/main/public/controllers/management/components/management/configuration/util-components/configuration-setting.js index 3f1ad0aac4..07d4292d90 100644 --- a/plugins/main/public/controllers/management/components/management/configuration/util-components/configuration-setting.js +++ b/plugins/main/public/controllers/management/components/management/configuration/util-components/configuration-setting.js @@ -15,7 +15,6 @@ import PropTypes from 'prop-types'; import { EuiAccordion, EuiBasicTable } from '@elastic/eui'; import { EuiFieldText, EuiSpacer, EuiTextAlign } from '@elastic/eui'; import WzConfigurationSettingsHeader from '../util-components/configuration-settings-header'; -import { webDocumentationLink } from '../../../../../../../common/services/web_documentation'; import helpLinks from '../log-collection/help-links'; class WzConfigurationSetting extends Component { @@ -39,7 +38,7 @@ class WzConfigurationSetting extends Component { } render() { const { isMobile } = this.state; - const { keyItem, label, value, columns } = this.props; + const { keyItem, label, value, columns, info } = this.props; return value || typeof value === 'number' || typeof value === 'boolean' ? ( <>
{value.map((group, groupIndex) => ( ); })} diff --git a/plugins/main/public/controllers/management/components/management/configuration/util-components/help-button-popover.js b/plugins/main/public/controllers/management/components/management/configuration/util-components/help-button-popover.js index 9ffdd888d0..fdaae6bd01 100644 --- a/plugins/main/public/controllers/management/components/management/configuration/util-components/help-button-popover.js +++ b/plugins/main/public/controllers/management/components/management/configuration/util-components/help-button-popover.js @@ -45,7 +45,24 @@ class WzHelpButtonPopover extends Component { More info about this section - {links ? ( + {links && info ? ( + <> + {info} + {links.map(link => ( +
+ + {link.text} + +
+ ))} + + ) : info ? ( + {info} + ) : links ? ( links.map(link => (
)) - ) : info ? ( - {info} ) : ( - JJAJAJ + [] )}
From d0c62339ff04cc345ecc2c776af4ca554037c5d4 Mon Sep 17 00:00:00 2001 From: JuanGarriuz Date: Thu, 18 Apr 2024 14:06:44 +0200 Subject: [PATCH 11/17] Added changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dbeb290603..aeb63a0a96 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ All notable changes to the Wazuh app project will be documented in this file. - Handle index pattern selector on new discover [#6499](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6499) - Added macOS log collector tab [#6545](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6545) - Added journald log collector tab [#6572](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6572) + ### Changed - Removed embedded discover [#6120](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6120) [#6235](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6235) [#6254](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6254) [#6285](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6285) [#6288](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6288) [#6290](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6290) [#6289](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6289) [#6286](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6286) [#6275](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6275) [#6287](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6297](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6297) [#6287](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6291](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6459](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6459) [#6434](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6434) From 64418f7966411e70442d812593208dd2951ffddd Mon Sep 17 00:00:00 2001 From: JuanGarriuz Date: Thu, 18 Apr 2024 16:28:59 +0200 Subject: [PATCH 12/17] Fix changelog and message popover improve --- CHANGELOG.md | 2 +- .../util-components/help-button-popover.js | 26 +++---------------- 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aeb63a0a96..bd2a2f0c0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,7 @@ All notable changes to the Wazuh app project will be documented in this file. - Added macOS log collector tab [#6545](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6545) - Added journald log collector tab [#6572](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6572) - ### Changed +### Changed - Removed embedded discover [#6120](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6120) [#6235](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6235) [#6254](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6254) [#6285](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6285) [#6288](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6288) [#6290](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6290) [#6289](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6289) [#6286](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6286) [#6275](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6275) [#6287](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6297](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6297) [#6287](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6291](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6459](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6459) [#6434](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6434) - Develop logic of a new index for the fim module [#6227](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6227) diff --git a/plugins/main/public/controllers/management/components/management/configuration/util-components/help-button-popover.js b/plugins/main/public/controllers/management/components/management/configuration/util-components/help-button-popover.js index fdaae6bd01..d6aac28311 100644 --- a/plugins/main/public/controllers/management/components/management/configuration/util-components/help-button-popover.js +++ b/plugins/main/public/controllers/management/components/management/configuration/util-components/help-button-popover.js @@ -45,25 +45,9 @@ class WzHelpButtonPopover extends Component { More info about this section - {links && info ? ( - <> - {info} - {links.map(link => ( -
- - {link.text} - -
- ))} - - ) : info ? ( + <> {info} - ) : links ? ( - links.map(link => ( + {links.map(link => (
- )) - ) : ( - [] - )} + ))} +
); From e9df540aa83ba0b2dd5d602d42a3f7809e8c9568 Mon Sep 17 00:00:00 2001 From: JuanGarriuz Date: Thu, 18 Apr 2024 17:00:59 +0200 Subject: [PATCH 13/17] Update configuration-setting imports --- .../configuration/util-components/configuration-setting.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/main/public/controllers/management/components/management/configuration/util-components/configuration-setting.js b/plugins/main/public/controllers/management/components/management/configuration/util-components/configuration-setting.js index 07d4292d90..3714fa232a 100644 --- a/plugins/main/public/controllers/management/components/management/configuration/util-components/configuration-setting.js +++ b/plugins/main/public/controllers/management/components/management/configuration/util-components/configuration-setting.js @@ -12,8 +12,7 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; -import { EuiAccordion, EuiBasicTable } from '@elastic/eui'; -import { EuiFieldText, EuiSpacer, EuiTextAlign } from '@elastic/eui'; +import { EuiFieldText, EuiSpacer, EuiTextAlign, EuiAccordion, EuiBasicTable } from '@elastic/eui'; import WzConfigurationSettingsHeader from '../util-components/configuration-settings-header'; import helpLinks from '../log-collection/help-links'; From c2260ebd19831bb7bfb5f0fd1fece8fdfa9a48c2 Mon Sep 17 00:00:00 2001 From: Federico Rodriguez Date: Tue, 23 Apr 2024 17:44:38 +0200 Subject: [PATCH 14/17] Fix macOS log title --- .../log-collection/log-collection-macosevents.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-macosevents.js b/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-macosevents.js index ebb7bb14dd..1304c3fc0a 100644 --- a/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-macosevents.js +++ b/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-macosevents.js @@ -115,10 +115,16 @@ class WzConfigurationLogCollectionMacOSEvents extends Component { {currentConfig?.[LOGCOLLECTOR_LOCALFILE_PROP]?.[ LOCALFILE_MACOSEVENT_PROP ]?.length === 1 ? ( - + + + ) : null}
); From c34e94b386693ff2f0039f0d9ce99bfee01bd7bd Mon Sep 17 00:00:00 2001 From: JuanGarriuz Date: Wed, 24 Apr 2024 09:35:43 +0200 Subject: [PATCH 15/17] resolve comments --- .../log-collection/log-collection-journald.js | 2 +- .../util-components/help-button-popover.js | 24 ++++++++++--------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js b/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js index abea3441b8..d2a9773e8c 100644 --- a/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js +++ b/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js @@ -118,7 +118,7 @@ class WzConfigurationLogCollectionJournald extends Component { ) : null} {currentConfig?.[LOGCOLLECTOR_LOCALFILE_PROP]?.[ LOCALFILE_JOURNALDT_PROP - ]?.length === 1 ? ( + ]?.length ? ( <> {info} - {links.map(link => ( -
- - {link.text} - -
- ))} + {Array.isArray(links) + ? links.map(link => ( +
+ + {link.text} + +
+ )) + : null}
From a61ecfe3237116f124b51d0b478170d295c22eaf Mon Sep 17 00:00:00 2001 From: JuanGarriuz Date: Wed, 24 Apr 2024 11:23:31 +0200 Subject: [PATCH 16/17] Fixed info euitext render and header no render in journald tab --- .../log-collection/log-collection-journald.js | 16 +++++++++++----- .../util-components/help-button-popover.js | 4 +++- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js b/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js index d2a9773e8c..400bceb45c 100644 --- a/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js +++ b/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection-journald.js @@ -118,11 +118,17 @@ class WzConfigurationLogCollectionJournald extends Component { ) : null} {currentConfig?.[LOGCOLLECTOR_LOCALFILE_PROP]?.[ LOCALFILE_JOURNALDT_PROP - ]?.length ? ( - + ]?.length === 1 ? ( + + + ) : null} ); diff --git a/plugins/main/public/controllers/management/components/management/configuration/util-components/help-button-popover.js b/plugins/main/public/controllers/management/components/management/configuration/util-components/help-button-popover.js index 1ec95e7277..3d258bac27 100644 --- a/plugins/main/public/controllers/management/components/management/configuration/util-components/help-button-popover.js +++ b/plugins/main/public/controllers/management/components/management/configuration/util-components/help-button-popover.js @@ -46,7 +46,9 @@ class WzHelpButtonPopover extends Component { More info about this section <> - {info} + {info ? ( + {info} + ) : null} {Array.isArray(links) ? links.map(link => (
From f6bfb96bd5ed908a97ab5f02b756a6297eadef23 Mon Sep 17 00:00:00 2001 From: JuanGarriuz Date: Wed, 24 Apr 2024 12:21:32 +0200 Subject: [PATCH 17/17] Add verification to mac and journald agents and add condition to journald --- .../log-collection/log-collection.js | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection.js b/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection.js index 97267150c9..2165ca50b8 100644 --- a/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection.js +++ b/plugins/main/public/controllers/management/components/management/configuration/log-collection/log-collection.js @@ -106,7 +106,7 @@ class WzConfigurationLogCollection extends Component { condition: currentConfig[LOGCOLLECTOR_LOCALFILE_PROP] && currentConfig[LOGCOLLECTOR_LOCALFILE_PROP][LOCALFILE_MACOSEVENT_PROP] - .length > 0, + ?.length > 0, component: ( 0, + currentConfig[LOGCOLLECTOR_LOCALFILE_PROP][LOCALFILE_JOURNALDT_PROP] + ?.length > 0, component: ( - - + @@ -131,10 +131,13 @@ class WzConfigurationLogCollection extends Component { ), }, { - condition: true, // Will always render + condition: + currentConfig[LOGCOLLECTOR_LOCALFILE_PROP] && + currentConfig[LOGCOLLECTOR_LOCALFILE_PROP][LOCALFILE_COMMANDS_PROP] + .length > 0, component: ( - - + @@ -144,8 +147,8 @@ class WzConfigurationLogCollection extends Component { { condition: true, // Will always render component: ( - - +