Go to the documentation of this file.
30 char src_ip[46] = { 0 }, dst_ip[46] = { 0 };
32 if (PacketIsIPv4(
p)) {
33 PrintInet(AF_INET, (
const void *)&(
p->
src.addr_data32[0]), src_ip,
sizeof(src_ip));
34 PrintInet(AF_INET, (
const void *)&(
p->
dst.addr_data32[0]), dst_ip,
sizeof(dst_ip));
35 }
else if (PacketIsIPv6(
p)) {
46 static bool CustomPacketLoggerCondition(
ThreadVars *
tv,
void *thread_data,
const Packet *)
54 char src_ip[46] = { 0 }, dst_ip[46] = { 0 };
87 SCLogNotice(
"Flow: %s:%u -> %s:%u", src_ip, sp, dst_ip, dp);
93 void *tx, uint64_t tx_id)
111 static void OnLoggingReady(
void *arg)
114 CustomPacketLoggerCondition, NULL, ThreadInit, ThreadDeinit);
116 "custom-flow-logger", CustomFlowLogger, NULL, ThreadInit, ThreadDeinit);
118 -1, -1, NULL, ThreadInit, ThreadDeinit);
121 static void Init(
void)
130 .name =
"CustomLogger",
131 .plugin_version =
"1.0.0",
132 .author =
"Firstname Lastname",
bool SCFlowIsIPv4(const Flow *flow)
Return true if the flow is IPv4.
const uint8_t * SCFlowGetSourceAddressAsRawPtr(const Flow *flow)
Returns a borrowed raw pointer to the flow source address.
uint16_t SCFlowGetDestinationPort(const Flow *flow)
Get flow destination port.
int SCOutputRegisterFlowLogger(const char *name, FlowLogger LogFunc, void *initdata, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit)
Register a flow logger.
int SCRegisterOnLoggingReady(SCOnLoggingReadyCallback callback, void *arg)
Register a callback to be called when logging is ready.
union Address_::@29 address
Per thread variable structure.
const char * PrintInet(int af, const void *src, char *dst, socklen_t size)
uint16_t SCFlowGetSourcePort(const Flow *flow)
Get flow source port.
int SCOutputRegisterTxLogger(LoggerId id, const char *name, AppProto alproto, TxLogger LogFunc, void *initdata, int tc_log_progress, int ts_log_progress, TxLoggerCondition LogCondition, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit)
Register a transaction logger.
int SCOutputRegisterPacketLogger(LoggerId logger_id, const char *name, PacketLogger LogFunc, PacketLogCondition ConditionFunc, void *initdata, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit)
Register a packet logger.
const uint8_t * SCFlowGetDestinationAddressAsRawPtr(const Flow *flow)
Returns a borrowed raw pointer to the flow destination address.
bool SCFlowIsIPv6(const Flow *flow)
Return true if the flow is IPv6.
const SCPlugin * SCPluginRegister(void)
#define SC_PACKAGE_VERSION
const SCPlugin PluginRegistration
uint64_t SCFlowGetFlags(const Flow *flow)
Get flow flags.
#define SCLogNotice(...)
Macro used to log NOTICE messages.
#define FLOW_DIR_REVERSED