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

Modify the default settings related to monitoring indices creation #3174

Merged
merged 9 commits into from
Apr 30, 2021
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

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

## Wazuh v4.2.0 - Kibana 7.10.2 , 7.11.2 - Revision 4202

### Changed

- Changed default `wazuh.monitoring.creation` app setting from `d` to `w` [#3174](https://github.com/wazuh/wazuh-kibana-app/pull/3174)
- Changed default `wazuh.monitoring.shards` app setting from `2` to `1` [#3174](https://github.com/wazuh/wazuh-kibana-app/pull/3174)

## Wazuh v4.2.0 - Kibana 7.10.2 , 7.11.2 - Revision 4201

### Added
Expand Down
8 changes: 3 additions & 5 deletions common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,17 @@ export const WAZUH_INDEX_SHARDS = 2;
export const WAZUH_INDEX_REPLICAS = 0;

// Job - Wazuh monitoring

export const WAZUH_INDEX_TYPE_MONITORING = "monitoring";
export const WAZUH_MONITORING_PREFIX = "wazuh-monitoring-";
export const WAZUH_MONITORING_PATTERN = "wazuh-monitoring-*";
export const WAZUH_MONITORING_TEMPLATE_NAME = "wazuh-agent";
export const WAZUH_MONITORING_DEFAULT_INDICES_SHARDS = WAZUH_INDEX_SHARDS;
export const WAZUH_MONITORING_DEFAULT_CREATION = 'd';
export const WAZUH_MONITORING_DEFAULT_INDICES_SHARDS = 1;
export const WAZUH_MONITORING_DEFAULT_CREATION = 'w';
export const WAZUH_MONITORING_DEFAULT_ENABLED = true;
export const WAZUH_MONITORING_DEFAULT_FREQUENCY = 900;
export const WAZUH_MONITORING_DEFAULT_CRON_FREQ = '0 * * * * *';

// Job - Wazuh statistics

export const WAZUH_INDEX_TYPE_STATISTICS = "statistics";
export const WAZUH_STATISTICS_DEFAULT_PREFIX = "wazuh";
export const WAZUH_STATISTICS_DEFAULT_NAME = "statistics";
Expand Down Expand Up @@ -166,7 +164,7 @@ export const WAZUH_DEFAULT_APP_CONFIG = {
'xpack.rbac.enabled': true,
'wazuh.monitoring.enabled': WAZUH_MONITORING_DEFAULT_ENABLED,
'wazuh.monitoring.frequency': WAZUH_MONITORING_DEFAULT_FREQUENCY,
'wazuh.monitoring.shards': WAZUH_INDEX_SHARDS,
'wazuh.monitoring.shards': WAZUH_MONITORING_DEFAULT_INDICES_SHARDS,
'wazuh.monitoring.replicas': WAZUH_INDEX_REPLICAS,
'wazuh.monitoring.creation': WAZUH_MONITORING_DEFAULT_CREATION,
'wazuh.monitoring.pattern': WAZUH_MONITORING_PATTERN,
Expand Down
5 changes: 3 additions & 2 deletions public/services/resolves/get-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
WAZUH_ALERTS_PATTERN,
WAZUH_INDEX_REPLICAS,
WAZUH_INDEX_SHARDS,
WAZUH_MONITORING_DEFAULT_INDICES_SHARDS,
WAZUH_MONITORING_PATTERN,
WAZUH_SAMPLE_ALERT_PREFIX
} from "../../../common/constants";
Expand Down Expand Up @@ -50,9 +51,9 @@ export async function getWzConfig($q, genericReq, wazuhConfig) {
'xpack.rbac.enabled': true,
'wazuh.monitoring.enabled': true,
'wazuh.monitoring.frequency': 900,
'wazuh.monitoring.shards': WAZUH_INDEX_SHARDS,
'wazuh.monitoring.shards': WAZUH_MONITORING_DEFAULT_INDICES_SHARDS,
'wazuh.monitoring.replicas': WAZUH_INDEX_REPLICAS,
'wazuh.monitoring.creation': 'd',
'wazuh.monitoring.creation': 'w',
'wazuh.monitoring.pattern': WAZUH_MONITORING_PATTERN,
'cron.prefix': 'wazuh',
'cron.statistics.status': true,
Expand Down
8 changes: 4 additions & 4 deletions server/lib/initial-wazuh-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ export const initialWazuhConfig: string = `---
#wazuh.monitoring.frequency: 900
#
# Configure wazuh-monitoring-* indices shards and replicas.
#wazuh.monitoring.shards: 2
#wazuh.monitoring.shards: 1
#wazuh.monitoring.replicas: 0
#
# Configure wazuh-monitoring-* indices custom creation interval.
# Values: h (hourly), d (daily), w (weekly), m (monthly)
# Default: d
#wazuh.monitoring.creation: d
# Default: w
#wazuh.monitoring.creation: w
#
# Default index pattern to use for Wazuh monitoring
#wazuh.monitoring.pattern: wazuh-monitoring-*
Expand All @@ -126,7 +126,7 @@ export const initialWazuhConfig: string = `---
#
# Customize the index prefix of predefined jobs
# This change is not retroactive, if you change it new indexes will be created
# cron.prefix: test
# cron.prefix: wazuh
#
# --------------------------------- wazuh-sample-alerts -------------------------
#
Expand Down
3 changes: 1 addition & 2 deletions server/start/monitoring/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { buildIndexSettings } from '../../lib/build-index-settings';
import { WazuhHostsCtrl } from '../../controllers/wazuh-hosts';
import {
WAZUH_MONITORING_PATTERN,
WAZUH_INDEX_SHARDS,
WAZUH_INDEX_REPLICAS,
WAZUH_MONITORING_TEMPLATE_NAME,
WAZUH_MONITORING_DEFAULT_INDICES_SHARDS,
Expand Down Expand Up @@ -280,7 +279,7 @@ async function createIndex(context, indexName: string) {
const IndexConfiguration = {
settings: {
index: {
number_of_shards: getAppConfigurationSetting('wazuh.monitoring.shards', appConfig, WAZUH_INDEX_SHARDS),
number_of_shards: getAppConfigurationSetting('wazuh.monitoring.shards', appConfig, WAZUH_MONITORING_DEFAULT_INDICES_SHARDS),
number_of_replicas: getAppConfigurationSetting('wazuh.monitoring.replicas', appConfig, WAZUH_INDEX_REPLICAS)
}
}
Expand Down