Skip to content

Commit 512d75b

Browse files
committed
doc/devguide: document eve callback
Document the callback for adding additional data to EVE. Ticket: OISF#4708
1 parent eb447d7 commit 512d75b

2 files changed

Lines changed: 44 additions & 0 deletions

File tree

doc/userguide/devguide/extending/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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: /** \brief 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: /** \brief 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

0 commit comments

Comments
 (0)