|
| 1 | +/* |
| 2 | + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one |
| 3 | + * or more contributor license agreements. Licensed under the Elastic License; |
| 4 | + * you may not use this file except in compliance with the Elastic License. |
| 5 | + */ |
| 6 | + |
| 7 | +import { i18n } from '@kbn/i18n'; |
| 8 | +import { schema } from '@kbn/config-schema'; |
| 9 | + |
| 10 | +import { CoreSetup } from '../../../../src/core/server'; |
| 11 | +import { |
| 12 | + DEFAULT_INDEX_KEY, |
| 13 | + DEFAULT_INDEX_PATTERN, |
| 14 | + DEFAULT_ANOMALY_SCORE, |
| 15 | + DEFAULT_SIEM_TIME_RANGE, |
| 16 | + DEFAULT_SIEM_REFRESH_INTERVAL, |
| 17 | + DEFAULT_INTERVAL_PAUSE, |
| 18 | + DEFAULT_INTERVAL_VALUE, |
| 19 | + DEFAULT_FROM, |
| 20 | + DEFAULT_TO, |
| 21 | + ENABLE_NEWS_FEED_SETTING, |
| 22 | + NEWS_FEED_URL_SETTING, |
| 23 | + NEWS_FEED_URL_SETTING_DEFAULT, |
| 24 | + IP_REPUTATION_LINKS_SETTING, |
| 25 | + IP_REPUTATION_LINKS_SETTING_DEFAULT, |
| 26 | +} from '../common/constants'; |
| 27 | + |
| 28 | +export const initUiSettings = (uiSettings: CoreSetup['uiSettings']) => { |
| 29 | + uiSettings.register({ |
| 30 | + [DEFAULT_SIEM_REFRESH_INTERVAL]: { |
| 31 | + type: 'json', |
| 32 | + name: i18n.translate('xpack.siem.uiSettings.defaultRefreshIntervalLabel', { |
| 33 | + defaultMessage: 'Time filter refresh interval', |
| 34 | + }), |
| 35 | + value: `{ |
| 36 | + "pause": ${DEFAULT_INTERVAL_PAUSE}, |
| 37 | + "value": ${DEFAULT_INTERVAL_VALUE} |
| 38 | +}`, |
| 39 | + description: i18n.translate('xpack.siem.uiSettings.defaultRefreshIntervalDescription', { |
| 40 | + defaultMessage: |
| 41 | + '<p>Default refresh interval for the SIEM time filter, in milliseconds.</p>', |
| 42 | + }), |
| 43 | + category: ['siem'], |
| 44 | + requiresPageReload: true, |
| 45 | + schema: schema.object({ |
| 46 | + value: schema.number(), |
| 47 | + pause: schema.boolean(), |
| 48 | + }), |
| 49 | + }, |
| 50 | + [DEFAULT_SIEM_TIME_RANGE]: { |
| 51 | + type: 'json', |
| 52 | + name: i18n.translate('xpack.siem.uiSettings.defaultTimeRangeLabel', { |
| 53 | + defaultMessage: 'Time filter period', |
| 54 | + }), |
| 55 | + value: `{ |
| 56 | + "from": "${DEFAULT_FROM}", |
| 57 | + "to": "${DEFAULT_TO}" |
| 58 | +}`, |
| 59 | + description: i18n.translate('xpack.siem.uiSettings.defaultTimeRangeDescription', { |
| 60 | + defaultMessage: '<p>Default period of time in the SIEM time filter.</p>', |
| 61 | + }), |
| 62 | + category: ['siem'], |
| 63 | + requiresPageReload: true, |
| 64 | + schema: schema.object({ |
| 65 | + from: schema.string(), |
| 66 | + to: schema.string(), |
| 67 | + }), |
| 68 | + }, |
| 69 | + [DEFAULT_INDEX_KEY]: { |
| 70 | + name: i18n.translate('xpack.siem.uiSettings.defaultIndexLabel', { |
| 71 | + defaultMessage: 'Elasticsearch indices', |
| 72 | + }), |
| 73 | + value: DEFAULT_INDEX_PATTERN, |
| 74 | + description: i18n.translate('xpack.siem.uiSettings.defaultIndexDescription', { |
| 75 | + defaultMessage: |
| 76 | + '<p>Comma-delimited list of Elasticsearch indices from which the SIEM app collects events.</p>', |
| 77 | + }), |
| 78 | + category: ['siem'], |
| 79 | + requiresPageReload: true, |
| 80 | + schema: schema.arrayOf(schema.string()), |
| 81 | + }, |
| 82 | + [DEFAULT_ANOMALY_SCORE]: { |
| 83 | + name: i18n.translate('xpack.siem.uiSettings.defaultAnomalyScoreLabel', { |
| 84 | + defaultMessage: 'Anomaly threshold', |
| 85 | + }), |
| 86 | + value: 50, |
| 87 | + type: 'number', |
| 88 | + description: i18n.translate('xpack.siem.uiSettings.defaultAnomalyScoreDescription', { |
| 89 | + defaultMessage: |
| 90 | + '<p>Value above which Machine Learning job anomalies are displayed in the SIEM app.</p><p>Valid values: 0 to 100.</p>', |
| 91 | + }), |
| 92 | + category: ['siem'], |
| 93 | + requiresPageReload: true, |
| 94 | + schema: schema.number(), |
| 95 | + }, |
| 96 | + [ENABLE_NEWS_FEED_SETTING]: { |
| 97 | + name: i18n.translate('xpack.siem.uiSettings.enableNewsFeedLabel', { |
| 98 | + defaultMessage: 'News feed', |
| 99 | + }), |
| 100 | + value: true, |
| 101 | + description: i18n.translate('xpack.siem.uiSettings.enableNewsFeedDescription', { |
| 102 | + defaultMessage: '<p>Enables the News feed</p>', |
| 103 | + }), |
| 104 | + type: 'boolean', |
| 105 | + category: ['siem'], |
| 106 | + requiresPageReload: true, |
| 107 | + schema: schema.boolean(), |
| 108 | + }, |
| 109 | + [NEWS_FEED_URL_SETTING]: { |
| 110 | + name: i18n.translate('xpack.siem.uiSettings.newsFeedUrl', { |
| 111 | + defaultMessage: 'News feed URL', |
| 112 | + }), |
| 113 | + value: NEWS_FEED_URL_SETTING_DEFAULT, |
| 114 | + description: i18n.translate('xpack.siem.uiSettings.newsFeedUrlDescription', { |
| 115 | + defaultMessage: '<p>News feed content will be retrieved from this URL</p>', |
| 116 | + }), |
| 117 | + category: ['siem'], |
| 118 | + requiresPageReload: true, |
| 119 | + schema: schema.string(), |
| 120 | + }, |
| 121 | + [IP_REPUTATION_LINKS_SETTING]: { |
| 122 | + name: i18n.translate('xpack.siem.uiSettings.ipReputationLinks', { |
| 123 | + defaultMessage: 'IP Reputation Links', |
| 124 | + }), |
| 125 | + value: IP_REPUTATION_LINKS_SETTING_DEFAULT, |
| 126 | + type: 'json', |
| 127 | + description: i18n.translate('xpack.siem.uiSettings.ipReputationLinksDescription', { |
| 128 | + defaultMessage: |
| 129 | + 'Array of URL templates to build the list of reputation URLs to be displayed on the IP Details page.', |
| 130 | + }), |
| 131 | + category: ['siem'], |
| 132 | + requiresPageReload: true, |
| 133 | + schema: schema.arrayOf( |
| 134 | + schema.object({ |
| 135 | + name: schema.string(), |
| 136 | + url_template: schema.string(), |
| 137 | + }) |
| 138 | + ), |
| 139 | + }, |
| 140 | + }); |
| 141 | +}; |
0 commit comments