-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Stack Monitoring] support custom ccs remote prefixes #129806
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
e7b55aa
add monitoring.ui.ccs.remotePatterns to config
neptunian 9391f2c
update alerts to use new config value
neptunian 48d84ed
update server/lib functions to use new config value
neptunian 2490bea
add monitoring.ui.ccs.remotePatterns to exposeToBrowser and support i…
neptunian 94171f3
allow ccs to be a string for api requests
neptunian 3549a74
change prefixIndexPattern to prefixIndexPatternWithCcs
neptunian 61c9b15
update alert tests for queries when using remotePatterns
neptunian 58f3f3a
add new setting to docs
neptunian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,13 +22,43 @@ export const monitoringElasticsearchConfigSchema = elasticsearchConfigSchema.ext | |
hosts: schema.maybe(schema.oneOf([hostURISchema, schema.arrayOf(hostURISchema, { minSize: 1 })])), | ||
}); | ||
|
||
const validateSingleCcsRemotePattern = (value: string) => { | ||
if (value.includes(' ')) { | ||
return 'Spaces are not allowed in a remote name.'; | ||
} | ||
if (value.match(/[^a-zA-Z\d\-_]/g)) { | ||
return 'Remote names contain only letters, numbers, underscores, and dashes.'; | ||
} | ||
}; | ||
const ccsSingleRemotePatternsSchema = schema.string({ | ||
validate(value) { | ||
return validateSingleCcsRemotePattern(value); | ||
}, | ||
}); | ||
const ccsMultiRemotePatternsSchema = schema.string({ | ||
validate(value) { | ||
if (value === '*') { | ||
return 'Cannot use the default wildcard (*) value in an array.'; | ||
} | ||
return validateSingleCcsRemotePattern(value); | ||
}, | ||
}); | ||
export const configSchema = schema.object({ | ||
ui: schema.object({ | ||
enabled: schema.boolean({ defaultValue: true }), | ||
debug_mode: schema.boolean({ defaultValue: false }), | ||
debug_log_path: schema.string({ defaultValue: '' }), | ||
ccs: schema.object({ | ||
enabled: schema.boolean({ defaultValue: true }), | ||
remotePatterns: schema.oneOf( | ||
[ | ||
ccsSingleRemotePatternsSchema, | ||
schema.arrayOf(ccsMultiRemotePatternsSchema, { minSize: 1, maxSize: 10 }), | ||
], | ||
{ | ||
defaultValue: '*', | ||
} | ||
), | ||
}), | ||
logs: schema.object({ | ||
index: schema.string({ defaultValue: 'filebeat-*' }), | ||
|
@@ -97,6 +127,10 @@ type MonitoringConfigTypeOverriddenUI = Omit<MonitoringConfigSchema, 'ui'>; | |
interface MonitoringConfigTypeOverriddenUIElasticsearch | ||
extends Omit<MonitoringConfigSchema['ui'], 'elasticsearch'> { | ||
elasticsearch: MonitoringElasticsearchConfig; | ||
ccs: { | ||
enabled: MonitoringConfigSchema['ui']['ccs']['enabled']; | ||
remotePatterns: string[]; | ||
}; | ||
} | ||
|
||
/** | ||
|
@@ -114,6 +148,12 @@ export function createConfig(config: MonitoringConfigSchema): MonitoringConfig { | |
...config, | ||
ui: { | ||
...config.ui, | ||
ccs: { | ||
...config.ui.ccs, | ||
remotePatterns: Array.isArray(config.ui.ccs.remotePatterns) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is user specifies a string value put it in an array we only have to work with array type. |
||
? config.ui.ccs.remotePatterns | ||
: [config.ui.ccs.remotePatterns], | ||
}, | ||
elasticsearch: new MonitoringElasticsearchConfig(config.ui.elasticsearch), | ||
}, | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the name to have "WithCcs" because previously this function also handled appending
metricbeat-*
. Now it only does CCS so want to clarify that.