11import argparse
22from collections import OrderedDict
33import os
4+ import re
45
56import yaml
67
@@ -20,11 +21,24 @@ def document_fields(output, section, sections, path):
2021 output .write ("[float]\n " )
2122
2223 if "description" in section :
23- if "anchor" in section :
24+ if "anchor" in section and section [ "name" ] == "ECS" :
2425 output .write ("== {} fields\n \n " .format (section ["name" ]))
26+ output .write ("""
27+ This section defines Elastic Common Schema (ECS) fields—a common set of fields
28+ to be used when storing event data in {es}.
29+
30+ This is an exhaustive list, and fields listed here are not necessarily used by {beatname_uc}.
31+ The goal of ECS is to enable and encourage users of {es} to normalize their event data,
32+ so that they can better analyze, visualize, and correlate the data represented in their events.
33+
34+ See the {ecs-ref}[ECS reference] for more information.
35+ """ )
36+ elif "anchor" in section :
37+ output .write ("== {} fields\n \n " .format (section ["name" ]))
38+ output .write ("{}\n \n " .format (section ["description" ]))
2539 else :
2640 output .write ("=== {}\n \n " .format (section ["name" ]))
27- output .write ("{}\n \n " .format (section ["description" ]))
41+ output .write ("{}\n \n " .format (section ["description" ]))
2842
2943 if "fields" not in section or not section ["fields" ]:
3044 return
@@ -70,6 +84,14 @@ def document_field(output, field, field_path):
7084 if "path" in field :
7185 output .write ("alias to: {}\n \n " .format (field ["path" ]))
7286
87+ # For Apm-Server docs only
88+ # Assign an ECS badge for fields containing "overwrite"
89+ if beat_title == "Apm-Server" :
90+ if "overwrite" in field :
91+ # And it's not a Kubernetes field
92+ if re .match ("^kubernetes.*" , field ["field_path" ]) is None :
93+ output .write ("{yes-icon} {ecs-ref}[ECS] field.\n \n " )
94+
7395 if "index" in field :
7496 if not field ["index" ]:
7597 output .write ("{}\n \n " .format ("Field is not indexed." ))
0 commit comments