Skip to content

Commit

Permalink
doc/userguide: generate eve documentation
Browse files Browse the repository at this point in the history
Add EVE documentation for QUIC and Pgsql to their respective sections of
the userguide.

Also add a complete EVE reference as an appendix.

Other protocols can be done, but its a manual process to document in the
schema, then add the glue to pull them into the documentation.

Currently the generated files need to be manually generated and
committed to git for ReadTheDocs to pick them up.
  • Loading branch information
jasonish committed Oct 4, 2024
1 parent d782ac2 commit f83bb45
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 3 deletions.
14 changes: 14 additions & 0 deletions doc/userguide/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
EXTRA_DIST = \
_generated \
_static \
3rd-party-integration \
acknowledgements.rst \
Expand All @@ -7,6 +8,7 @@ EXTRA_DIST = \
conf.py \
configuration \
devguide \
evedoc.py \
file-extraction \
index.rst \
upgrade \
Expand Down Expand Up @@ -88,6 +90,18 @@ $(dist_man1_MANS): _build/man

man: $(dist_man1_MANS)

# For the generated EVE schema docs, we have to list each one so they
# will generated for the "dist".
EXTRA_DIST += _generated/eve-index.rst \
_generated/quic.rst \
_generated/pgsql.rst

generate:
mkdir -p _generated
./evedoc.py --output _generated/eve-index.rst ../../etc/schema.json
./evedoc.py --output _generated/quic.rst --object quic ../../etc/schema.json
./evedoc.py --output _generated/pgsql.rst --object pgsql ../../etc/schema.json

# Remove build artifacts that aren't tracked by autotools.
clean-local:
rm -rf $(top_builddir)/doc/userguide/_build
Expand Down
7 changes: 7 additions & 0 deletions doc/userguide/appendix/eve-index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
EVE Index
=========

.. toctree::
:maxdepth: 1

.. include:: ../_generated/eve-index.rst
7 changes: 7 additions & 0 deletions doc/userguide/appendix/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Appendix
========

.. toctree::
:maxdepth: 1

eve-index
8 changes: 8 additions & 0 deletions doc/userguide/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,3 +338,11 @@ def setup(app):
"sysconfdir": os.getenv("sysconfdir", "/etc"),
"localstatedir": os.getenv("localstatedir", "/var"),
}

# Custom code generate some documentation.
# evedoc = "./evedoc.py"
# eve_schema = "../../etc/schema.json"
# os.makedirs("_generated", exist_ok=True)
# subprocess.call([evedoc, "--output", "_generated/eve-index.rst", eve_schema])
# for proto in ["quic", "pgsql"]:
# subprocess.call([evedoc, "--output", "_generated/{}.rst".format(proto), "--object", proto, eve_schema])
3 changes: 2 additions & 1 deletion doc/userguide/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ This is the documentation for Suricata |version|.
acknowledgements
licenses/index.rst
devguide/index.rst
verifying-source-files
verifying-source-files
appendix/index.rst
10 changes: 9 additions & 1 deletion doc/userguide/output/eve/eve-json-format.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2682,6 +2682,10 @@ References:
.. _PostgreSQL message format - BackendKeyData: https://www.postgresql.org/docs
/current/protocol-message-formats.html#PROTOCOL-MESSAGE-FORMATS-BACKENDKEYDATA

Field Reference
~~~~~~~~~~~~~~~

.. include:: ../../_generated/pgsql.rst

Event type: IKE
---------------
Expand Down Expand Up @@ -2937,6 +2941,11 @@ Example of QUIC logging with CYU, JA3 and JA4 hashes (note that the JA4 hash is
"ja4": "q13d0310h3_55b375c5d22e_cd85d2d88918"
}

Output Reference
~~~~~~~~~~~~~~~~

.. include:: ../../_generated/quic.rst

Event type: DHCP
-----------------

Expand Down Expand Up @@ -3048,4 +3057,3 @@ Example of ARP logging: request and response
"dest_mac": "00:1d:09:f0:92:ab",
"dest_ip": "10.10.10.1"
}

3 changes: 2 additions & 1 deletion etc/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
etcdatadir = $(datadir)/suricata

EXTRA_DIST = suricata.logrotate.in \
EXTRA_DIST = schema.json \
suricata.logrotate.in \
suricata.service.in

dist_etcdata_DATA = classification.config \
Expand Down

0 comments on commit f83bb45

Please sign in to comment.