Skip to content

Commit

Permalink
[Osquery] update schemas (#128861)
Browse files Browse the repository at this point in the history
Update ECS and Osquery schemas
  • Loading branch information
tomsonpl authored Mar 31, 2022
1 parent ee443e9 commit cef1d43
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 9 deletions.

This file was deleted.

Large diffs are not rendered by default.

This file was deleted.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion x-pack/plugins/osquery/public/editor/osquery_tables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ let osqueryTables: TablesJSON | null = null;
export const getOsqueryTables = () => {
if (!osqueryTables) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
osqueryTables = normalizeTables(require('../common/schemas/osquery/v5.0.1.json'));
osqueryTables = normalizeTables(require('../common/schemas/osquery/v5.2.2.json'));
}
return osqueryTables;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ import styled from 'styled-components';
import deepEqual from 'fast-deep-equal';
import deepmerge from 'deepmerge';

import ECSSchema from '../../common/schemas/ecs/v1.12.1.json';
import osquerySchema from '../../common/schemas/osquery/v5.0.1.json';
import ECSSchema from '../../common/schemas/ecs/v8.2.0.json';
import osquerySchema from '../../common/schemas/osquery/v5.2.2.json';

import { FieldIcon } from '../../common/lib/kibana';
import {
Expand Down
5 changes: 4 additions & 1 deletion x-pack/plugins/osquery/scripts/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@ currently manually curated). This assumes the targeted schema files will be in
`public/editor/osquery_schema`.

```
node scripts/schema_formatter --schema_version=v4.6.0
node ecs.js --schema_version=4.6.0 // (filename without .json extension)
Possibly it's going to be necessary to transform fields' names into lower case, because CSV exports Fields with Capital Letters.
node osquery.js --schema_version=4.6.0 // (filename without .json extension)
```
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const RESTRICTED_FIELDS = [

run(
async ({ flags }) => {
const schemaPath = path.resolve(`public/common/schemas/ecs/`);
const schemaPath = path.resolve(`../../public/common/schemas/ecs/`);
const schemaFile = path.join(schemaPath, flags.schema_version as string);
const schemaData = await require(schemaFile);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const ELASTIC_OSQUERY_HOSTFS_TABLES = ['users', 'groups', 'processes'];

run(
async ({ flags }) => {
const schemaPath = path.resolve(`../public/common/schemas/osquery/`);
const schemaPath = path.resolve(`../../public/common/schemas/osquery/`);
const schemaFile = path.join(schemaPath, flags.schema_version as string);
const schemaData = await require(schemaFile);

Expand All @@ -28,7 +28,7 @@ run(
formattedSchema.push(...elasticTables);

await fs.writeFile(
path.join(schemaPath, `${flags.schema_version}`),
path.join(schemaPath, `v${flags.schema_version}-formatted`),
JSON.stringify(formattedSchema)
);
},
Expand Down

0 comments on commit cef1d43

Please sign in to comment.