es_archiver empty-monitoring-index action#112376
es_archiver empty-monitoring-index action#112376matschaffer wants to merge 1 commit intoelastic:mainfrom
Conversation
💚 Build SucceededMetrics [docs]
To update your PR or re-run it, just comment with: cc @matschaffer |
| } | ||
|
|
||
| function isMonitoringIndex(index?: string): index is string { | ||
| return Boolean(index && /^\.monitoring-.*$/.test(index)); |
There was a problem hiding this comment.
Is this a necessary check? Can't we trust that since we only asked for indexes matching .monitoring-* that this will always return true?
There was a problem hiding this comment.
Definitely not, just a hackey first cut to get the string assertion.
|
|
||
| async function fetchMonitoringIndices(client: KibanaClient) { | ||
| const resp = await client.cat.indices( | ||
| { index: '.monitoring-*', format: 'json' }, |
There was a problem hiding this comment.
Rather than hard-coding the .monitoring-* index pattern here I'd much prefer that require specifying an index pattern on the CLI and then pass it in, so that all indexes which match that wildcard pattern will be deleted. Thoughts?
There was a problem hiding this comment.
Yep. Sure could. I don't consider this PR final, hence the draft status. I was basically just trying it out as a stub here. Curious to get your thoughts on #88986 (comment) before proceeding.
There was a problem hiding this comment.
Per feedback there, I'll plan to update this to be node scripts/es_archiver.js delete-indices '.monitoring-*' so we can use on any index pattern needed.
| stats: Stats; | ||
| log: ToolingLog; | ||
| }) { | ||
| deleteMonitoringIndices({ client, stats, log }); |
|
Closing this down. It seemed like a good idea at the time, but in practice it's easy enough to restart |
Summary
Adds a
node scripts/es_archiver.js empty-monitoring-indexShould be runnable like this against the observablity-dev docker testing setup.
But you first have to grab the ca from the docker volume.
I also seem to be running into some stale javascript file issues,
yarn kbn bootstrapseems to be needed to ensure you're using the latest local code.