Skip to content

Commit

Permalink
output-tx: remove ThreadExitPrintStats callback
Browse files Browse the repository at this point in the history
After removing the exit stats function from log-tlslog, this callback
is no longer used.

Ticket: OISF#7227
  • Loading branch information
jasonish authored and Corey Thomas committed Sep 3, 2024
1 parent bce0646 commit 63a5e65
Show file tree
Hide file tree
Showing 21 changed files with 103 additions and 166 deletions.
2 changes: 1 addition & 1 deletion src/log-httplog.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ int LogHttpLogger(ThreadVars *tv, void *thread_data, const Packet *, Flow *f, vo
void LogHttpLogRegister (void)
{
OutputRegisterTxModule(LOGGER_HTTP, MODULE_NAME, "http-log", LogHttpLogInitCtx, ALPROTO_HTTP1,
LogHttpLogger, LogHttpLogThreadInit, LogHttpLogThreadDeinit, NULL);
LogHttpLogger, LogHttpLogThreadInit, LogHttpLogThreadDeinit);
}

#define LOG_HTTP_CF_REQUEST_HOST 'h'
Expand Down
2 changes: 1 addition & 1 deletion src/log-tlslog.c
Original file line number Diff line number Diff line change
Expand Up @@ -501,5 +501,5 @@ void LogTlsLogRegister(void)
{
OutputRegisterTxModuleWithProgress(LOGGER_TLS, MODULE_NAME, "tls-log", LogTlsLogInitCtx,
ALPROTO_TLS, LogTlsLogger, TLS_HANDSHAKE_DONE, TLS_HANDSHAKE_DONE, LogTlsLogThreadInit,
LogTlsLogThreadDeinit, NULL);
LogTlsLogThreadDeinit);
}
4 changes: 2 additions & 2 deletions src/log-tlsstore.c
Original file line number Diff line number Diff line change
Expand Up @@ -437,11 +437,11 @@ void LogTlsStoreRegister (void)
{
OutputRegisterTxModuleWithCondition(LOGGER_TLS_STORE, MODULE_NAME, "tls-store",
LogTlsStoreLogInitCtx, ALPROTO_TLS, LogTlsStoreLogger, LogTlsStoreCondition,
LogTlsStoreLogThreadInit, LogTlsStoreLogThreadDeinit, NULL);
LogTlsStoreLogThreadInit, LogTlsStoreLogThreadDeinit);

OutputRegisterTxModuleWithCondition(LOGGER_TLS_STORE_CLIENT, MODULE_NAME, "tls-store",
LogTlsStoreLogInitCtx, ALPROTO_TLS, LogTlsStoreLoggerClient, LogTlsStoreConditionClient,
LogTlsStoreLogThreadInit, LogTlsStoreLogThreadDeinit, NULL);
LogTlsStoreLogThreadInit, LogTlsStoreLogThreadDeinit);

SC_ATOMIC_INIT(cert_id);
SC_ATOMIC_SET(cert_id, 1);
Expand Down
7 changes: 3 additions & 4 deletions src/output-json-anomaly.c
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,7 @@ void JsonAnomalyLogRegister (void)
JsonAnomalyLogInitCtxSub, JsonAnomalyLogger, JsonAnomalyLogCondition,
JsonAnomalyLogThreadInit, JsonAnomalyLogThreadDeinit);

OutputRegisterTxSubModule(LOGGER_JSON_ANOMALY, "eve-log", MODULE_NAME,
"eve-log.anomaly", JsonAnomalyLogInitCtxHelper, ALPROTO_UNKNOWN,
JsonAnomalyTxLogger, JsonAnomalyLogThreadInit,
JsonAnomalyLogThreadDeinit, NULL);
OutputRegisterTxSubModule(LOGGER_JSON_ANOMALY, "eve-log", MODULE_NAME, "eve-log.anomaly",
JsonAnomalyLogInitCtxHelper, ALPROTO_UNKNOWN, JsonAnomalyTxLogger,
JsonAnomalyLogThreadInit, JsonAnomalyLogThreadDeinit);
}
2 changes: 1 addition & 1 deletion src/output-json-dcerpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void JsonDCERPCLogRegister(void)
/* Register as an eve sub-module. */
OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonDCERPCLog", "eve-log.dcerpc",
DCERPCLogInitSub, ALPROTO_DCERPC, JsonDCERPCLogger, JsonLogThreadInit,
JsonLogThreadDeinit, NULL);
JsonLogThreadDeinit);

SCLogDebug("DCERPC JSON logger registered.");
}
2 changes: 1 addition & 1 deletion src/output-json-dhcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,5 +148,5 @@ void JsonDHCPLogRegister(void)
/* Register as an eve sub-module. */
OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonDHCPLog", "eve-log.dhcp",
OutputDHCPLogInitSub, ALPROTO_DHCP, JsonDHCPLogger, JsonDHCPLogThreadInit,
JsonDHCPLogThreadDeinit, NULL);
JsonDHCPLogThreadDeinit);
}
2 changes: 1 addition & 1 deletion src/output-json-dnp3.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,5 +365,5 @@ void JsonDNP3LogRegister(void)
{
OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonDNP3Log", "eve-log.dnp3",
OutputDNP3LogInitSub, ALPROTO_DNP3, JsonDNP3Logger, JsonDNP3LogThreadInit,
JsonDNP3LogThreadDeinit, NULL);
JsonDNP3LogThreadDeinit);
}
4 changes: 2 additions & 2 deletions src/output-json-dns.c
Original file line number Diff line number Diff line change
Expand Up @@ -672,12 +672,12 @@ void JsonDnsLogRegister (void)
{
OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", MODULE_NAME, "eve-log.dns",
JsonDnsLogInitCtxSub, ALPROTO_DNS, JsonDnsLogger, LogDnsLogThreadInit,
LogDnsLogThreadDeinit, NULL);
LogDnsLogThreadDeinit);
}

void JsonDoh2LogRegister(void)
{
OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonDoH2Log", "eve-log.doh2",
JsonDnsLogInitCtxSub, ALPROTO_DOH2, JsonDoh2Logger, LogDnsLogThreadInit,
LogDnsLogThreadDeinit, NULL);
LogDnsLogThreadDeinit);
}
2 changes: 1 addition & 1 deletion src/output-json-http.c
Original file line number Diff line number Diff line change
Expand Up @@ -654,5 +654,5 @@ void JsonHttpLogRegister (void)
/* register as child of eve-log */
OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonHttpLog", "eve-log.http",
OutputHttpLogInitSub, ALPROTO_HTTP1, JsonHttpLogger, JsonHttpLogThreadInit,
JsonHttpLogThreadDeinit, NULL);
JsonHttpLogThreadDeinit);
}
2 changes: 1 addition & 1 deletion src/output-json-ike.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,5 +184,5 @@ void JsonIKELogRegister(void)
/* Register as an eve sub-module. */
OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonIKELog", "eve-log.ike",
OutputIKELogInitSub, ALPROTO_IKE, JsonIKELogger, JsonIKELogThreadInit,
JsonIKELogThreadDeinit, NULL);
JsonIKELogThreadDeinit);
}
2 changes: 1 addition & 1 deletion src/output-json-mqtt.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,5 +194,5 @@ void JsonMQTTLogRegister(void)
{
OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonMQTTLog", "eve-log.mqtt",
OutputMQTTLogInitSub, ALPROTO_MQTT, JsonMQTTLogger, JsonMQTTLogThreadInit,
JsonMQTTLogThreadDeinit, NULL);
JsonMQTTLogThreadDeinit);
}
2 changes: 1 addition & 1 deletion src/output-json-nfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ void JsonNFSLogRegister(void)
{
/* Register as an eve sub-module. */
OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonNFSLog", "eve-log.nfs", NFSLogInitSub,
ALPROTO_NFS, JsonNFSLogger, JsonLogThreadInit, JsonLogThreadDeinit, NULL);
ALPROTO_NFS, JsonNFSLogger, JsonLogThreadInit, JsonLogThreadDeinit);

SCLogDebug("NFS JSON logger registered.");
}
2 changes: 1 addition & 1 deletion src/output-json-pgsql.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ void JsonPgsqlLogRegister(void)
/* Register as an eve sub-module. */
OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonPgsqlLog", "eve-log.pgsql",
OutputPgsqlLogInitSub, ALPROTO_PGSQL, JsonPgsqlLogger, JsonPgsqlLogThreadInit,
JsonPgsqlLogThreadDeinit, NULL);
JsonPgsqlLogThreadDeinit);

SCLogDebug("PostgreSQL JSON logger registered.");
}
2 changes: 1 addition & 1 deletion src/output-json-smb.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void JsonSMBLogRegister(void)
{
/* Register as an eve sub-module. */
OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonSMBLog", "eve-log.smb", SMBLogInitSub,
ALPROTO_SMB, JsonSMBLogger, JsonLogThreadInit, JsonLogThreadDeinit, NULL);
ALPROTO_SMB, JsonSMBLogger, JsonLogThreadInit, JsonLogThreadDeinit);

SCLogDebug("SMB JSON logger registered.");
}
2 changes: 1 addition & 1 deletion src/output-json-smtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,5 +193,5 @@ void JsonSmtpLogRegister (void) {
/* register as child of eve-log */
OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonSmtpLog", "eve-log.smtp",
OutputSmtpLogInitSub, ALPROTO_SMTP, JsonSmtpLogger, JsonSmtpLogThreadInit,
JsonSmtpLogThreadDeinit, NULL);
JsonSmtpLogThreadDeinit);
}
2 changes: 1 addition & 1 deletion src/output-json-tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -718,5 +718,5 @@ void JsonTlsLogRegister (void)
/* register as child of eve-log */
OutputRegisterTxSubModuleWithProgress(LOGGER_JSON_TX, "eve-log", "JsonTlsLog", "eve-log.tls",
OutputTlsLogInitSub, ALPROTO_TLS, JsonTlsLogger, TLS_HANDSHAKE_DONE, TLS_HANDSHAKE_DONE,
JsonTlsLogThreadInit, JsonTlsLogThreadDeinit, NULL);
JsonTlsLogThreadInit, JsonTlsLogThreadDeinit);
}
28 changes: 3 additions & 25 deletions src/output-tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,13 @@ typedef struct OutputTxLogger_ {
int ts_log_progress;
TmEcode (*ThreadInit)(ThreadVars *, const void *, void **);
TmEcode (*ThreadDeinit)(ThreadVars *, void *);
void (*ThreadExitPrintStats)(ThreadVars *, void *);
} OutputTxLogger;

static OutputTxLogger **list = NULL;

int OutputRegisterTxLogger(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,
void (*ThreadExitPrintStats)(ThreadVars *, void *))
ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit)
{
if (list == NULL) {
list = SCCalloc(ALPROTO_MAX, sizeof(OutputTxLogger *));
Expand All @@ -93,7 +91,6 @@ int OutputRegisterTxLogger(LoggerId id, const char *name, AppProto alproto, TxLo
op->logger_id = id;
op->ThreadInit = ThreadInit;
op->ThreadDeinit = ThreadDeinit;
op->ThreadExitPrintStats = ThreadExitPrintStats;

if (alproto == ALPROTO_UNKNOWN) {
op->tc_log_progress = 0;
Expand Down Expand Up @@ -628,25 +625,6 @@ static TmEcode OutputTxLogThreadDeinit(ThreadVars *tv, void *thread_data)
return TM_ECODE_OK;
}

static void OutputTxLogExitPrintStats(ThreadVars *tv, void *thread_data)
{
OutputTxLoggerThreadData *op_thread_data = (OutputTxLoggerThreadData *)thread_data;

for (AppProto alproto = 0; alproto < ALPROTO_MAX; alproto++) {
OutputLoggerThreadStore *store = op_thread_data->store[alproto];
OutputTxLogger *logger = list[alproto];

while (logger && store) {
if (logger->ThreadExitPrintStats) {
logger->ThreadExitPrintStats(tv, store->thread_data);
}

logger = logger->next;
store = store->next;
}
}
}

static uint32_t OutputTxLoggerGetActiveCount(void)
{
uint32_t cnt = 0;
Expand Down Expand Up @@ -676,8 +654,8 @@ void OutputTxLoggerRegister (void)
if (unlikely(list == NULL)) {
FatalError("Failed to allocate OutputTx list");
}
OutputRegisterRootLogger(OutputTxLogThreadInit, OutputTxLogThreadDeinit,
OutputTxLogExitPrintStats, OutputTxLog, OutputTxLoggerGetActiveCount);
OutputRegisterRootLogger(OutputTxLogThreadInit, OutputTxLogThreadDeinit, NULL, OutputTxLog,
OutputTxLoggerGetActiveCount);
}

void OutputTxShutdown(void)
Expand Down
2 changes: 1 addition & 1 deletion src/output-tx.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ typedef bool (*TxLoggerCondition)(

int OutputRegisterTxLogger(LoggerId id, const char *name, AppProto alproto, TxLogger LogFunc,
void *, int tc_log_progress, int ts_log_progress, TxLoggerCondition LogCondition,
ThreadInitFunc, ThreadDeinitFunc, void (*ThreadExitPrintStats)(ThreadVars *, void *));
ThreadInitFunc, ThreadDeinitFunc);

void OutputTxLoggerRegister (void);

Expand Down
Loading

0 comments on commit 63a5e65

Please sign in to comment.