Skip to content

Commit

Permalink
[Endpoint] Log random seed for sample data CLI to console (#60646) (#…
Browse files Browse the repository at this point in the history
…60988)

* log random seed to console

* fix off by 1 error with children
  • Loading branch information
marshallmain authored Mar 24, 2020
1 parent ba1d11e commit d8c1bbf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion x-pack/plugins/endpoint/common/generate_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ export class EndpointDocGenerator {
for (let i = 0; i < generations; i++) {
const newParents: EndpointEvent[] = [];
parents.forEach(element => {
const numChildren = this.randomN(maxChildrenPerNode);
const numChildren = this.randomN(maxChildrenPerNode + 1);
for (let j = 0; j < numChildren; j++) {
timestamp = timestamp + 1000;
const child = this.generateEvent({
Expand Down
9 changes: 7 additions & 2 deletions x-pack/plugins/endpoint/scripts/resolver_generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,13 @@ async function main() {
process.exit(1);
}
}

const generator = new EndpointDocGenerator(argv.seed);
let seed = argv.seed;
if (!seed) {
seed = Math.random().toString();
// eslint-disable-next-line no-console
console.log('No seed supplied, using random seed: ' + seed);
}
const generator = new EndpointDocGenerator(seed);
for (let i = 0; i < argv.numHosts; i++) {
await client.index({
index: argv.metadataIndex,
Expand Down

0 comments on commit d8c1bbf

Please sign in to comment.