Skip to content

Commit

Permalink
docs: update generate_fields_docs.py (elastic#21359)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmorelli25 authored Oct 6, 2020
1 parent a2decea commit bf971f3
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 10 deletions.
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
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 @@ -44228,8 +44228,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:
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 @@ -9371,8 +9371,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 @@ -2128,8 +2128,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

0 comments on commit bf971f3

Please sign in to comment.