File tree Expand file tree Collapse file tree
doc/userguide/devguide/extending Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,3 +10,4 @@ Extending Suricata
1010 detect/index.rst
1111 output/index.rst
1212 output/eve-filetypes.rst
13+ output/eve-hooks.rst
Original file line number Diff line number Diff line change 1+ EVE Hooks
2+ #########
3+
4+ The EVE output provides a callback for additional data to be added to
5+ an EVE record before it is written.
6+
7+ It is important to note that it does not allow for modification of the
8+ EVE record due to the append only nature of Suricata's EVE output.
9+
10+ Registration
11+ ************
12+
13+ Registering the callback is done with ``SCEveRegisterCallback ``.
14+
15+ .. literalinclude :: ../../../../../src/output-eve.h
16+ :language: c
17+ :start-at: /** \b rief Register a callback for adding extra information to EVE
18+ :end-at: );
19+
20+ Callback
21+ ********
22+
23+ The callback function is provided with an open ``SCJsonBuilder ``
24+ instance just before being closed out with a final ``} ``. Additional
25+ fields can be added with the ``SCJsonBuilder `` API.
26+
27+ .. literalinclude :: ../../../../../src/output-eve.h
28+ :language: c
29+ :start-at: /** \b rief Function type for EVE callbacks
30+ :end-at: );
31+
32+ Example
33+ *******
34+
35+ For a real-life example, see the ``ndpi `` plugin included in the
36+ Suricata source.
37+
38+ The example demonstrates:
39+
40+ - Registering an EVE callback during plugin initialization
41+ - Using thread-local storage to maintain state
42+ - Adding protocol-specific information to EVE records
43+ - Properly checking for NULL pointers before accessing data
You can’t perform that action at this time.
0 commit comments