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

docs: Update generate_fields_docs.py #21359

Merged
merged 1 commit into from
Oct 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 8 additions & 1 deletion auditbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -2914,8 +2914,15 @@ type: object
[[exported-fields-ecs]]
== ECS fields

ECS Fields.

This section defines Elastic Common Schema (ECS) fields—a common set of fields
Copy link

Choose a reason for hiding this comment

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

Do we want to call out that ECS is an open source specification? Otherwise, it LGMT!

to be used when storing event data in {es}.

This is an exhaustive list, and fields listed here are not necessarily used by {beatname_uc}.
The goal of ECS is to enable and encourage users of {es} to normalize their event data,
so that they can better analyze, visualize, and correlate the data represented in their events.

See the {ecs-ref}[ECS reference] for more information.

*`@timestamp`*::
+
Expand Down
9 changes: 8 additions & 1 deletion filebeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -44041,8 +44041,15 @@ type: object
[[exported-fields-ecs]]
== ECS fields

ECS Fields.

This section defines Elastic Common Schema (ECS) fields—a common set of fields
to be used when storing event data in {es}.

This is an exhaustive list, and fields listed here are not necessarily used by {beatname_uc}.
The goal of ECS is to enable and encourage users of {es} to normalize their event data,
so that they can better analyze, visualize, and correlate the data represented in their events.

See the {ecs-ref}[ECS reference] for more information.

*`@timestamp`*::
+
Expand Down
9 changes: 8 additions & 1 deletion heartbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,15 @@ type: object
[[exported-fields-ecs]]
== ECS fields

ECS Fields.

This section defines Elastic Common Schema (ECS) fields—a common set of fields
to be used when storing event data in {es}.

This is an exhaustive list, and fields listed here are not necessarily used by {beatname_uc}.
The goal of ECS is to enable and encourage users of {es} to normalize their event data,
so that they can better analyze, visualize, and correlate the data represented in their events.

See the {ecs-ref}[ECS reference] for more information.

*`@timestamp`*::
+
Expand Down
9 changes: 8 additions & 1 deletion journalbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -914,8 +914,15 @@ type: object
[[exported-fields-ecs]]
== ECS fields

ECS Fields.

This section defines Elastic Common Schema (ECS) fields—a common set of fields
to be used when storing event data in {es}.

This is an exhaustive list, and fields listed here are not necessarily used by {beatname_uc}.
The goal of ECS is to enable and encourage users of {es} to normalize their event data,
so that they can better analyze, visualize, and correlate the data represented in their events.

See the {ecs-ref}[ECS reference] for more information.

*`@timestamp`*::
+
Expand Down
26 changes: 24 additions & 2 deletions libbeat/scripts/generate_fields_docs.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import argparse
from collections import OrderedDict
import os
import re

import yaml

Expand All @@ -20,11 +21,24 @@ def document_fields(output, section, sections, path):
output.write("[float]\n")

if "description" in section:
if "anchor" in section:
if "anchor" in section and section["name"] == "ECS":
output.write("== {} fields\n\n".format(section["name"]))
output.write("""
This section defines Elastic Common Schema (ECS) fields—a common set of fields
to be used when storing event data in {es}.

This is an exhaustive list, and fields listed here are not necessarily used by {beatname_uc}.
The goal of ECS is to enable and encourage users of {es} to normalize their event data,
so that they can better analyze, visualize, and correlate the data represented in their events.

See the {ecs-ref}[ECS reference] for more information.
""")
elif "anchor" in section:
output.write("== {} fields\n\n".format(section["name"]))
output.write("{}\n\n".format(section["description"]))
else:
output.write("=== {}\n\n".format(section["name"]))
output.write("{}\n\n".format(section["description"]))
output.write("{}\n\n".format(section["description"]))

if "fields" not in section or not section["fields"]:
return
Expand Down Expand Up @@ -70,6 +84,14 @@ def document_field(output, field, field_path):
if "path" in field:
output.write("alias to: {}\n\n".format(field["path"]))

# For Apm-Server docs only
# Assign an ECS badge for fields containing "overwrite"
if beat_title == "Apm-Server":
if "overwrite" in field:
# And it's not a Kubernetes field
if re.match("^kubernetes.*", field["field_path"]) is None:
Copy link
Member Author

Choose a reason for hiding this comment

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

kubernetes.* fields had to be excluded here as they're not ECS fields, but APM marks them as overwrite:true.

output.write("{yes-icon} {ecs-ref}[ECS] field.\n\n")

if "index" in field:
if not field["index"]:
output.write("{}\n\n".format("Field is not indexed."))
Expand Down
9 changes: 8 additions & 1 deletion metricbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -9164,8 +9164,15 @@ Stats collected from Dropwizard.
[[exported-fields-ecs]]
== ECS fields

ECS Fields.

This section defines Elastic Common Schema (ECS) fields—a common set of fields
to be used when storing event data in {es}.

This is an exhaustive list, and fields listed here are not necessarily used by {beatname_uc}.
The goal of ECS is to enable and encourage users of {es} to normalize their event data,
so that they can better analyze, visualize, and correlate the data represented in their events.

See the {ecs-ref}[ECS reference] for more information.

*`@timestamp`*::
+
Expand Down
9 changes: 8 additions & 1 deletion packetbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -2127,8 +2127,15 @@ type: object
[[exported-fields-ecs]]
== ECS fields

ECS Fields.

This section defines Elastic Common Schema (ECS) fields—a common set of fields
to be used when storing event data in {es}.

This is an exhaustive list, and fields listed here are not necessarily used by {beatname_uc}.
The goal of ECS is to enable and encourage users of {es} to normalize their event data,
so that they can better analyze, visualize, and correlate the data represented in their events.

See the {ecs-ref}[ECS reference] for more information.

*`@timestamp`*::
+
Expand Down
9 changes: 8 additions & 1 deletion winlogbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,15 @@ type: object
[[exported-fields-ecs]]
== ECS fields

ECS Fields.

This section defines Elastic Common Schema (ECS) fields—a common set of fields
to be used when storing event data in {es}.

This is an exhaustive list, and fields listed here are not necessarily used by {beatname_uc}.
The goal of ECS is to enable and encourage users of {es} to normalize their event data,
so that they can better analyze, visualize, and correlate the data represented in their events.

See the {ecs-ref}[ECS reference] for more information.

*`@timestamp`*::
+
Expand Down
9 changes: 8 additions & 1 deletion x-pack/functionbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,15 @@ type: object
[[exported-fields-ecs]]
== ECS fields

ECS Fields.

This section defines Elastic Common Schema (ECS) fields—a common set of fields
to be used when storing event data in {es}.

This is an exhaustive list, and fields listed here are not necessarily used by {beatname_uc}.
The goal of ECS is to enable and encourage users of {es} to normalize their event data,
so that they can better analyze, visualize, and correlate the data represented in their events.

See the {ecs-ref}[ECS reference] for more information.

*`@timestamp`*::
+
Expand Down