Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
394b1cb
Adding initial spec files
ycombinator Jul 28, 2020
2967350
Renaming version folder name
ycombinator Jul 29, 2020
bdffdfa
Updating README for version folder name change
ycombinator Jul 29, 2020
5558e48
Adding header comments to spec files
ycombinator Jul 29, 2020
2419161
Clarifying syntax vs. semantics in README
ycombinator Jul 29, 2020
eb9a53e
Fleshing out package manifest.yml spec
ycombinator Jul 29, 2020
904bc9b
Updating README
ycombinator Jul 29, 2020
d0d5255
Making more similar to JSON schema
ycombinator Jul 29, 2020
c2a1e1a
Moving version folder under versions/ + updating README to match
ycombinator Jul 29, 2020
5c81724
Fleshing out some more specs
ycombinator Jul 29, 2020
7eff101
Add pattern for package name
ycombinator Jul 30, 2020
10449e0
Updating README
ycombinator Jul 30, 2020
fe691af
Resolving some TODOs
ycombinator Jul 30, 2020
73b7e4d
Fleshing out fields spec
ycombinator Jul 30, 2020
367be0d
Fleshing out CHANGELOG spec
ycombinator Jul 30, 2020
e3cc793
Updating description for multi field
ycombinator Jul 30, 2020
18863b1
Adding yaml as supported variable type
ycombinator Jul 30, 2020
f0ab0e9
Document show_user
ycombinator Jul 30, 2020
08e40c7
Add TODO for addressing spec duplication later
ycombinator Jul 30, 2020
b0c05d6
Fix inconsistency in description
ycombinator Jul 30, 2020
431d3c7
Updating README
ycombinator Jul 30, 2020
5f4f5c1
Introducing contents + renaming specRef to $ref
ycombinator Jul 30, 2020
fd5303c
Making file contents schemas strict
ycombinator Jul 30, 2020
07bbedd
Fleshing out README on versioning
ycombinator Aug 1, 2020
41bb01c
Add descriptions to some properties
ycombinator Aug 1, 2020
e6e5b3f
Renaming versions/1.0.0 => versions/1
ycombinator Aug 1, 2020
e9a6dbd
Fixing version numbers of folders
ycombinator Aug 1, 2020
0f15458
Clarifying version property + adding it
ycombinator Aug 1, 2020
da00c28
Adding CHANGELOG under versions/1
ycombinator Aug 1, 2020
dd76b6d
Ignoring ECS-metadata fields group and level
ycombinator Aug 1, 2020
0141965
Removing removable field
ycombinator Aug 1, 2020
6c38cc1
Updating version fields' regexes
ycombinator Aug 1, 2020
e585265
Use only basic license for now
ycombinator Aug 1, 2020
930d297
Fixing typos
ycombinator Aug 3, 2020
e4b6e97
Adding WARNING to README
ycombinator Aug 3, 2020
d475a6d
Adding more ES field datatypes
ycombinator Aug 3, 2020
6024684
Cross referencing spec against package-registry struct fields
ycombinator Aug 3, 2020
e315c0d
Added index_pattern folder to kibana folder spec
ycombinator Aug 3, 2020
396721e
Removing default_field from spec
ycombinator Aug 4, 2020
076597f
Updating fields folder spec
ycombinator Aug 5, 2020
4085ee2
Removing solution fields/values
ycombinator Aug 5, 2020
3bb6f7c
Adding elasticsearch section to dataset manifest spec
ycombinator Aug 5, 2020
d99805f
Linting spec YAMLs
ycombinator Aug 5, 2020
bed02b2
Fixing typos
ycombinator Aug 5, 2020
ac61112
Removing development-time comments
ycombinator Aug 5, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,20 @@ In the future it may also contain code for validating said specifications.
# Purpose

Please use this repository to discuss any changes to the specification, either my making issues or PRs to the specification.

# Specification Format

An Elastic Package specification describes:
1. the folder structure of packages and expected files within these folders; and
2. the structure of the expected files' contents.

There may be multiple versions of specifications. At the root of this repository is a `versions` folder. In this folder you will find sub-folders for each active version of the specification.

Within each version folder, there must be a `spec.yml` file. This file is the entry point for the specification for a package's contents. It describes the the folder structure of packages and expected files within these folders (this is point 1. above). The specification is expressed using a schema similar to [JSON Schema](https://json-schema.org/), but with a couple of differences:
- The `type` field can be either `folder` or `file`,
- A new field field, `specRef` is introduced to (recursively) reference other specification files, and
- The specification is written as YAML for readability.

Expected package files, e.g. `manifest.yml` themselves have a structure to their contents. This structure is described in specification files using JSON schema (this is point 2. above). These specification files are also written as YAML for readability.

Note that the specification files primarily defined the structure (syntax) of a package's contents. To a limited extent they may also define some semantics, e.g. enumeration values for certain fields. Richer semantics, however, will need to be expressed as validation code.
Comment thread
ycombinator marked this conversation as resolved.
46 changes: 46 additions & 0 deletions versions/1.0.0/changelog.spec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
##
## Describes the specification for the package's CHANGELOG file
##
spec:
# Everything under here follows JSON schema (https://json-schema.org/), written as YAML for readability
type: array
items:
type: object
properties:
version:
description: Package version.
type: string
pattern: "^[0-9]+\.[0-9]+\.[0-9]+$"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you can use the semver pattern.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 6c38cc1 (using the regex from my previous comment).

examples:
- "1.0.4"
changes:
description: List of changes in package version.
type: array
items:
type: object
properties:
description:
description: Description of change.
type: string
examples:
- "Fix broken template"
type:
description: Type of change.
type: string
enum:
- "breaking-change"
- "bugfix"
- "enhancement"
- "known-issue"
link:
description: Link to issue or PR describing change in detail.
type: string
examples:
- "https://github.com/elastic/beats/issues/13507"
required:
- description
- type
- link
required:
- version
- changes
41 changes: 41 additions & 0 deletions versions/1.0.0/dataset/fields/fields.spec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
##

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, we are getting a spec version of the fields.yml. This is huge. @webmat You will like this for ECS if you don't already have it.

## Describes the specification for a dataset's various field definition files
##
spec:
# Everything under here follows JSON schema (https://json-schema.org/), written as YAML for readability
type: object
properties:
name:
description: Name of field
type: string
title:
description: Title of field
type: string
type:
description: Datatype of field
type: string
enum:
- constant_keyword

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these can be any valid elasticsearch type right? Or is this just meant as an example?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right these should be any valid Elasticsearch field datatype. I will add the rest. Thanks!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in d475a6d.

- date
- group
description:
description: Short description of field
type: string
group:
Comment thread
ycombinator marked this conversation as resolved.
Outdated
description: TODO
type: int
level:
Comment thread
ycombinator marked this conversation as resolved.
Outdated
description: TODO
type: string
enum:
- custom
default_field:

@ycombinator ycombinator Jul 30, 2020

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jonathan-buttner I saw this default_field field used here https://github.com/elastic/package-registry/blob/98d7184cfe5b1d271e1bef848a5720073959888e/testdata/package/ecs_style_dataset/0.0.1/dataset/foo/fields/fields.yml#L16. Could you tell me what it is meant for so I could appropriately describe it in this schema here? Thanks!

@ruflin ruflin Jul 31, 2020

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ycombinator I think we got rid of default_field and it was replaced by show_user and some others. So this is only here because it was not cleaned up. Found it also in other places.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, ignore my comment above, just realised this is fields.yml.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ruflin @mtojek Do you have any idea what the purpose of this default_field is?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea at all, I think you can safely ignore/remove this field from spec.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I will remove it from the spec, similar to the level and group fields which were removed in dd76b6d.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in 396721e.

description: "Is this field a default? TODO: better description"
type: boolean
default: true
fields:
description: Sub-fields, when type is group
$ref: "#" # JSON-schema syntax for pointing to the root of the schema
required:
- name
- type
27 changes: 27 additions & 0 deletions versions/1.0.0/dataset/fields/spec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
spec:
- name: base fields
description: Base fields definitions
type: file
name: "base-fields.yml"
required: true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the only constraints is that somewhere in the fields defined in the dataset/fields directory is a definition for the "base" fields (dataset.*). They don't have to be in a certain file. For example: https://github.com/elastic/endpoint-package/tree/master/package/endpoint/dataset/file/fields

Is valid.
https://github.com/elastic/endpoint-package/blob/master/package/endpoint/dataset/file/fields/fields.yml#L66

@ruflin correct me if I'm wrong, but a package developer can name the "fields.yml" whatever they want right? I can't remember if it is actually enforced by the registry or if it just looks for a file that's yml format.

contentMediaType: "application/x-yaml"
specRef: "fields.spec.yml"
- name: dataset fields
description: Dataset-specific fields definitions
type: file
name: "fields.yml"
required: true
contentMediaType: "application/x-yaml"
specRef: "fields.spec.yml"
- name: package fields
description: Package-specific fields definitions
type: file
name: "package-fields.yml"
contentMediaType: "application/x-yaml"
specRef: "fields.spec.yml"
- name: ECS fields
description: ECS fields definitions
type: file
name: "ecs.yml"
contentMediaType: "application/x-yaml"
specRef: "fields.spec.yml"
104 changes: 104 additions & 0 deletions versions/1.0.0/dataset/manifest.spec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
##
## Describes the specification for a dataset's manifest.yml file
##
spec:
# Everything under here follows JSON schema (https://json-schema.org/), written as YAML for readability
type: object
properties:
title:
description: Title of dataset.
type: string
examples:
- AWS billing metrics
release:
description: Stability of dataset.
type: string
enum:
- experimental
- beta
examples:
- beta
type:
description: Type of dataset
type: string
enum:
- metrics
- logs
examples:
- metrics
streams:
description: Streams offered by dataset.
type: array
items:
type: object
properties:
title:
type: string
examples:
- AWS Billing metrics
description:
type: string
examples:
- Collect AWS billing metrics
input:
type: string
examples:
- aws/metrics
- s3
- file
vars:
description: Input variables.
type: array
items:
type: object
properties:
name:
description: Variable name.
type: string
examples:
- hosts
type:
description: Data type of variable.
type: string
enum:
- text
examples:
- text
title:
description: Title of variable
type: string
examples:
- Hosts
multi:
description: TODO
type: boolean
default: false
examples:
- true
required:
description: Is variable required?
type: boolean
default: false
examples:
- true
show_user:
description: TODO
type: boolean
default: true
examples:
- false
default:
description: Default value(s) for variable
type: array
items:
type: string
examples:
- "http://127.0.0.1"
required:
- name
- type
required:
- title
- description
required:
- title

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's another section here that the registry supports:

https://github.com/elastic/endpoint-package/blob/master/package/endpoint/dataset/file/manifest.yml#L7
It corresponds to this: https://github.com/elastic/package-registry/blob/master/util/dataset.go#L48

This part can be any fields you want:
https://github.com/elastic/endpoint-package/blob/master/package/endpoint/dataset/file/manifest.yml#L9

It's a way to set settings and mappings in component templates for ES.

@ruflin I know there was discussion about not using that though? And instead just using a raw json template component file? Do you know if the plan is to keep that section around?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, I didn't know there is such section :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets have it in for now and discuss if we remove it for 7.10 and update the packages.

@ycombinator ycombinator Aug 5, 2020

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in 3bb6f7c.

45 changes: 45 additions & 0 deletions versions/1.0.0/dataset/spec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
spec:
- description: Folder containing a single dataset definition
type: folder
pattern: "[a-z0-9][a-z0-9_]+[a-z0-9]"
Comment thread
ycombinator marked this conversation as resolved.
Outdated
minOccurences: 1
spec:
- description: A dataset's manifest file
type: file
contentMediaType: "application/x-yaml"
name: "manifest.yml"
required: true
specRef: "manifest.spec.yml"
- description: Folder containing field definitions
type: folder
name: fields
required: true
specRef: "fields/spec.yml"
- description: Folder containing agent-related definitions
type: folder
name: agent
required: true
spec:
- description: Folder containing agent stream definitions
type: folder
name: stream
required: true
spec:
- description: Agent stream definition
type: file
name: "stream.yml.hbs"
contentMediaType: "application/x-hbs"
required: true
- description: Folder containing Elasticsearch assets
type: folder
name: elasticsearch
spec:
- description: Folder containing Elasticsearch Ingest Node pipeline definitions
type: folder
name: ingest_pipeline
spec:
- description: Default ingest pipeline definition
type: file
name: "default.yml"
contentMediaType: "application/x-yaml"
required: true
37 changes: 37 additions & 0 deletions versions/1.0.0/kibana/spec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
spec:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty cool that we can also describe the assets.

- description: Folder containing Kibana dashboard assets
type: folder
name: dashboard
required: false
spec:
- description: A dashboard asset file
type: file
contentMediaType: "application/json"
pattern: ".+\.json"
- description: Folder containing Kibana visualization assets
type: folder
name: visualization
required: false
spec:
- description: A visualization asset file
type: file
contentMediaType: "application/json"
pattern: ".+\.json"
- description: Folder containing Kibana saved search assets
type: folder
name: search
required: false
spec:
- description: A saved search asset file
type: file
contentMediaType: "application/json"
pattern: ".+\.json"
- description: Folder containing Kibana map assets
type: folder
name: map
required: false
spec:
- description: A map asset file
type: file
contentMediaType: "application/json"
pattern: ".+\.json"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Index patterns is another possible folder:
https://github.com/elastic/endpoint-package/tree/v0.9.0/package/endpoint/kibana/index_pattern

Although there's a bug with the ingest manager when using it right now: elastic/kibana#70864

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in e315c0d.

Loading