const char *nulls = ConfNodeLookupChildValue(conf, "null-values");
SCLogDebug("totals %s threads %s", totals, threads);
+ if ((totals != NULL && ConfValIsFalse(totals)) &&
+ (threads != NULL && ConfValIsFalse(threads))) {
+ LogFileFreeCtx(file_ctx);
+ SCFree(statslog_ctx);
+ SCLogError(SC_ERR_STATS_LOG_NEGATED,
+ "Cannot disable both totals and threads in stats logging");
+ return NULL;
+ }
+
if (totals != NULL && ConfValIsFalse(totals)) {
statslog_ctx->flags &= ~LOG_STATS_TOTALS;
}
const char *deltas = ConfNodeLookupChildValue(conf, "deltas");
SCLogDebug("totals %s threads %s deltas %s", totals, threads, deltas);
+ if ((totals != NULL && ConfValIsFalse(totals)) &&
+ (threads != NULL && ConfValIsFalse(threads))) {
+ SCFree(stats_ctx);
+ SCLogError(SC_ERR_JSON_STATS_LOG_NEGATED,
+ "Cannot disable both totals and threads in stats logging");
+ return NULL;
+ }
+
if (totals != NULL && ConfValIsFalse(totals)) {
stats_ctx->flags &= ~JSON_STATS_TOTALS;
}
CASE_CODE (SC_ERR_MT_NO_MAPPING);
CASE_CODE (SC_ERR_NO_JSON_SUPPORT);
CASE_CODE (SC_ERR_INVALID_RULE_ARGUMENT);
+ CASE_CODE (SC_ERR_STATS_LOG_NEGATED);
+ CASE_CODE (SC_ERR_JSON_STATS_LOG_NEGATED);
}
return "UNKNOWN_ERROR";
SC_ERR_INVALID_RULE_ARGUMENT, /**< Generic error code for invalid
* rule argument. */
SC_ERR_MT_NO_MAPPING,
+ SC_ERR_STATS_LOG_NEGATED, /** When totals and threads are both NO in yaml **/
+ SC_ERR_JSON_STATS_LOG_NEGATED, /** When totals and threads are both NO in yaml **/
} SCError;
const char *SCErrorToString(SCError);