Skip to content

Commit

Permalink
examples: add tx logger to custom logger example
Browse files Browse the repository at this point in the history
However, its disabled due to issue
https://redmine.openinfosecfoundation.org/issues/7236.

Ticket: OISF#7227
  • Loading branch information
jasonish authored and victorjulien committed Aug 31, 2024
1 parent 7397b7a commit 1f63e7b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions examples/plugins/c-custom-loggers/custom-logger.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include "output-packet.h"
#include "output-flow.h"
#include "output-tx.h"
#include "util-print.h"

static int CustomPacketLogger(ThreadVars *tv, void *thread_data, const Packet *p)
Expand Down Expand Up @@ -78,6 +79,15 @@ static int CustomFlowLogger(ThreadVars *tv, void *thread_data, Flow *f)
return 0;
}

#if 0
static int CustomDnsLogger(ThreadVars *tv, void *thread_data, const Packet *p, Flow *f, void *state,
void *tx, uint64_t tx_id)
{
SCLogNotice("We have a DNS transaction");
return 0;
}
#endif

static TmEcode ThreadInit(ThreadVars *tv, const void *initdata, void **data)
{
return TM_ECODE_OK;
Expand All @@ -96,6 +106,15 @@ static void Init(void)
CustomPacketLoggerCondition, NULL, ThreadInit, ThreadDeinit);
SCOutputRegisterFlowLogger(
"custom-flow-logger", CustomFlowLogger, NULL, ThreadInit, ThreadDeinit);

/* Register a custom DNS transaction logger.
*
* Currently disabled due to https://redmine.openinfosecfoundation.org/issues/7236.
*/
#if 0
OutputRegisterTxLogger(LOGGER_USER, "custom-dns-logger", ALPROTO_DNS, CustomDnsLogger, NULL, -1,
-1, NULL, ThreadInit, ThreadDeinit);
#endif
}

const SCPlugin PluginRegistration = {
Expand Down

0 comments on commit 1f63e7b

Please sign in to comment.