Skip to content
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

model: ECS for 6.x #1609

Merged
merged 41 commits into from
Dec 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
a6af765
add ECS aliases
graphaelli Nov 28, 2018
701050d
exclude aliases
graphaelli Nov 30, 2018
ceeffdb
copy ECS fields where required
graphaelli Nov 29, 2018
99c19c7
take ownership of host.name
graphaelli Nov 30, 2018
75a4085
update request url fields
graphaelli Nov 30, 2018
4c40f12
map meta.cloud.*
graphaelli Dec 3, 2018
bb6dd7b
Merge remote-tracking branch 'elastic/6.x' into ecs-6.x
graphaelli Dec 5, 2018
e122d1d
account for new fields
graphaelli Dec 5, 2018
3a7330a
add fields missing from migration log + test
graphaelli Dec 5, 2018
4c4f153
copy context.process.argv to process.args
graphaelli Dec 5, 2018
4702718
alias host.hostname to context.system.hostname, instead of host.name
graphaelli Dec 6, 2018
1b24cdd
fix process.args exception
graphaelli Dec 6, 2018
5f5110f
add event.timezone
graphaelli Dec 7, 2018
bbd74c5
Update changelog for 6.5 (#1626) (#1627)
simitt Dec 6, 2018
1623c46
Merge pull request #1613 from kuisathaverat/legacy-paths (#1633)
graphaelli Dec 10, 2018
a1691ff
[6.x] package docker container images with mage (#1632)
graphaelli Dec 10, 2018
db16a71
<update beats here>
graphaelli Dec 10, 2018
8430094
regenerate fields doc with updated script
graphaelli Dec 10, 2018
3ce04c0
add non-indexed fields
graphaelli Dec 10, 2018
bd15cba
add exceptions for all non-indexed fields
graphaelli Dec 11, 2018
eb87599
sync with latest ECS
graphaelli Dec 11, 2018
c72fbd1
remove fields from processors
graphaelli Dec 11, 2018
fe3f320
sort
graphaelli Dec 11, 2018
444fbf8
consolidate context.http
graphaelli Dec 11, 2018
81303c6
add more non-indexed fields
graphaelli Dec 11, 2018
2948e80
alias user.ip and user_agent.original.text
graphaelli Dec 12, 2018
8e8880b
Merge remote-tracking branch 'elastic/6.x' into ecs-6.x
graphaelli Dec 12, 2018
b444e4b
alias observer.listening -> listening
graphaelli Dec 12, 2018
6301a52
Merge remote-tracking branch 'elastic/6.x' into ecs-6.x
graphaelli Dec 13, 2018
9526e03
restore host metadata fields that are not conflicting
graphaelli Dec 13, 2018
7c83ca4
account for beats ecs migrations
graphaelli Dec 13, 2018
da90de7
alias client.ip -> context.user.ip
graphaelli Dec 13, 2018
5ebf75e
alias http.response.status_code -> context.response.status_code
graphaelli Dec 13, 2018
629356d
alias http.response.finished -> context.response.finished
graphaelli Dec 13, 2018
c45b98d
mapping complete?
graphaelli Dec 13, 2018
2a8fecf
pep8
graphaelli Dec 13, 2018
1004b8f
alias process.args -> context.process.argv instead of copying
graphaelli Dec 13, 2018
a548225
Merge remote-tracking branch 'elastic/6.x' into ecs-6.x
graphaelli Dec 14, 2018
cd12363
remove process.args
graphaelli Dec 14, 2018
304bcc7
unit test ECS transformations on transactions
graphaelli Dec 14, 2018
fb54f5e
remove context.tags -> labels copy
graphaelli Dec 15, 2018
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
5 changes: 0 additions & 5 deletions _beats/dev-tools/ecs-migration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@

# Beat fields

- from: beat.hostname
to: host.hostname
alias6: true
alias: true

- from: beat.timezone
to: event.timezone
alias6: true
Expand Down
3 changes: 0 additions & 3 deletions _beats/libbeat/_meta/fields.common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@
Alias fields for compatibility with 7.x.
fields:
# Common Beats fields
- name: host.hostname
type: alias
path: beat.hostname
- name: event.timezone
type: alias
path: beat.timezone
Expand Down
13 changes: 0 additions & 13 deletions _beats/libbeat/processors/add_host_metadata/_meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,6 @@
type: keyword
description: >
Unique host id.
- name: architecture
type: keyword
description: >
Host architecture (e.g. x86_64, arm, ppc, mips).
- name: os.platform
type: keyword
description: >
OS platform (e.g. centos, ubuntu, windows).
- name: os.version
type: keyword
description: >
Expand All @@ -31,12 +23,7 @@
type: keyword
description: >
OS family (e.g. redhat, debian, freebsd, windows).
- name: ip
type: ip
description: >
List of IP-addresses.
- name: mac
type: keyword
description: >
List of hardware-addresses, usually MAC-addresses.

25 changes: 21 additions & 4 deletions _beats/libbeat/scripts/generate_fields_docs.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import yaml
import os
import argparse
from collections import OrderedDict
import os

import yaml


def document_fields(output, section, sections, path):
Expand Down Expand Up @@ -66,8 +68,8 @@ def document_field(output, field, field_path):
if not field["index"]:
output.write("{}\n\n".format("Field is not indexed."))

if "enable" in field:
if not field["enable"]:
if "enabled" in field:
if not field["enabled"]:
output.write("{}\n\n".format("Object is not enabled."))

if "multi_fields" in field:
Expand Down Expand Up @@ -103,6 +105,21 @@ def fields_to_asciidoc(input, output, beat):
print("fields.yml file is empty. fields.asciidoc cannot be generated.")
return

# deduplicate fields, last one wins
for section in docs:
if not section.get("fields"):
continue
fields = OrderedDict()
for field in section["fields"]:
name = field["name"]
if name in fields:
assert field["type"] == fields[name]["type"], 'field "{}" redefined with different type "{}"'.format(
name, field["type"])
fields[name].update(field)
else:
fields[name] = field
section["fields"] = list(fields.values())

# Create sections from available fields
sections = {}
for v in docs:
Expand Down
140 changes: 140 additions & 0 deletions _meta/ecs-migration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# The ECS migration file contains the information about all the fields which are migrated to ECS in 7.0.
# The goal of the file is to potentially have scripts on top of this information to convert visualisations and templates
# based on this information in an automated way and to keep track of all changes which were applied.
#
# The format of the file is as following:
#
# - from: source-field-in-6.x
# to: target-filed-in-ECS
# # Alias field is useful for fields where there is a 1-1 mapping from old to new
# alias: true-if-alias-is-required-in-6x (default is true)
# # Copy to is useful for fields where multiple fields map to the same ECS field
# copy_to: true-if-field-should-be-copied-to-target-in-6x (default is false)

- from: beat.hostname
to: observer.hostname

- from: beat.name
to: observer.type

- from: beat.version
to: observer.version

- from: context.service.agent.name
to: agent.name
graphaelli marked this conversation as resolved.
Show resolved Hide resolved

- from: context.service.agent.version
to: agent.version

- from: context.system.architecture
to: host.architecture

- from: context.system.hostname
to: host.hostname
webmat marked this conversation as resolved.
Show resolved Hide resolved

- from: context.system.ip
to: host.ip

- from: context.system.platform
to: host.os.platform

- from: context.request.method
to: http.request.method

- from: context.request.http_version
to: http.version
simitt marked this conversation as resolved.
Show resolved Hide resolved

- from: context.process.pid
to: process.pid

- from: context.process.ppid
to: process.ppid

- from: context.process.title
to: process.title
graphaelli marked this conversation as resolved.
Show resolved Hide resolved

# not in ECS
- from: context.service.environment
to: service.environment

# not in ECS
- from: context.service.framework.name
to: service.framework.name

# not in ECS
- from: context.service.framework.version
ruflin marked this conversation as resolved.
Show resolved Hide resolved
to: service.framework.version

# not in ECS
- from: context.service.language.name
to: service.language.name

# not in ECS
- from: context.service.language.version
to: service.language.version

- from: context.service.name
to: service.name

# not in ECS
- from: context.service.runtime.name
to: service.runtime.name

# not in ECS
- from: context.service.runtime.version
to: service.runtime.version

- from: context.service.version
to: service.version

- from: context.request.url.full
Copy link
Member

Choose a reason for hiding this comment

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

@webmat I wonder if we should allow to nest url also under request. Feels pretty natural.

Copy link

Choose a reason for hiding this comment

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

If there's only one URL in the event, I don't see a reason to do move it around.

We need to control in how many places things can be nested. Each time we do this, we're growing the amounts of expected places that fields can be found in ECS, which is contrary to ECS' goal of making things easier to find across data sources.

to: url.full

- from: context.request.url.hash
to: url.fragment

- from: context.request.url.hostname
to: url.domain

- from: context.request.url.pathname
to: url.path

- from: context.request.url.port
to: url.port
alias: false
copy_to: true

- from: context.request.url.raw
to: url.original
simitt marked this conversation as resolved.
Show resolved Hide resolved

- from: context.request.url.search
to: url.query

- from: context.request.url.protocol
to: url.scheme
alias: false
copy_to: true

- from: context.response.finished
to: http.response.finished

- from: context.response.status_code
to: http.response.status_code

- from: context.user.email
to: user.email

- from: context.user.id
to: user.id

- from: context.user.username
to: user.name

- from: context.user.ip
to: client.ip
graphaelli marked this conversation as resolved.
Show resolved Hide resolved

- from: context.user.user-agent
to: user_agent.original.text
Copy link

Choose a reason for hiding this comment

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

user_agent.original.text would be a multi-field, which is defined in the context of the "real" field, which is user_agent.original in this case.

I guess we're hitting a corner case here. The field (in terms of setting an alias) is moving to user_agent.original. I'm not sure it's possible to create an alias to a multi-field. We need to look into this.

But the usage side, if APM intends to use this as "what field does the query target", then yeah it's now user_agent.original.text.

cc @ruflin

Copy link
Member Author

Choose a reason for hiding this comment

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

you can alias to a multi-field but not back from a multi-field (marked as a non-reversible alias)


- from: listening
to: observer.listening
graphaelli marked this conversation as resolved.
Show resolved Hide resolved
Loading