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

[Backport 4.5-7.10] Add ignore and restrict fields #5223

Merged
merged 2 commits into from
Mar 8, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ All notable changes to the Wazuh app project will be documented in this file.

### Added

-
- 2 fields (ignore and restrict) are added in the `Management/Configuration/Log collection`. [#5203](https://github.com/wazuh/wazuh-kibana-app/pull/5203)

### Changed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,21 @@ import React, { Component, Fragment } from 'react';
import WzNoConfig from '../util-components/no-config';
import WzConfigurationSettingsTabSelector from '../util-components/configuration-settings-tab-selector';
import WzConfigurationListSelector from '../util-components/configuration-settings-list-selector';
import { isString, renderValueOrDefault, renderValueOrNoValue } from '../utils/utils';
import { isString, renderValueOrNoValue } from '../utils/utils';
import { settingsListBuilder } from '../utils/builders';

import helpLinks from './help-links';
import { LOGCOLLECTOR_LOCALFILE_PROP, LOCALFILE_LOGS_PROP } from './types';

const renderTargetField = (item) => (item ? item.join(', ') : 'agent');
const renderArrayObjectField = arrayObjectField => {
const stringToRender = arrayObjectField
? arrayObjectField
.map(({ value, type }) => value?.concat(type ? ` (${type})` : ''))
.join(', ')
: '-';
return stringToRender;
};

const mainSettings = [
{ field: 'logformat', label: 'Log format' },
Expand Down Expand Up @@ -53,6 +61,16 @@ const mainSettings = [
label: 'Redirect output to this socket',
render: renderTargetField,
},
{
field: 'ignore',
label: 'If the expression matches, the log will be ignored',
render: renderArrayObjectField,
},
{
field: 'restrict',
label: 'The log will only be processed if the expression matches',
render: renderArrayObjectField,
},
];

const getMainSettingsAgentOrManager = (agent) =>
Expand Down