Go to the documentation of this file.
81 const uint64_t tx_id,
const bool stored, uint8_t dir,
HttpXFFCfg *xff_cfg,
122 SCJsonBuilderMark mark = { 0, 0, 0 };
126 SCJbOpenObject(js,
"http");
131 SCJbGetMark(js, &mark);
132 SCJbOpenObject(js,
"smtp");
136 SCJbRestoreMark(js, &mark);
138 SCJbGetMark(js, &mark);
139 SCJbOpenObject(js,
"email");
143 SCJbRestoreMark(js, &mark);
148 SCJbGetMark(js, &mark);
149 SCJbOpenObject(js,
"rpc");
153 SCJbRestoreMark(js, &mark);
156 SCJbGetMark(js, &mark);
157 SCJbOpenObject(js,
"nfs");
161 SCJbRestoreMark(js, &mark);
165 SCJbGetMark(js, &mark);
166 SCJbOpenObject(js,
"smb");
170 SCJbRestoreMark(js, &mark);
175 if (al && al->
LogTx) {
176 void *state = FlowGetAppState(
p->
flow);
180 SCJbGetMark(js, &mark);
181 if (!al->
LogTx(tx, js)) {
182 SCJbRestoreMark(js, &mark);
192 SCJbOpenObject(js,
"fileinfo");
204 SCJbSetString(js,
"xff", xff_buffer);
215 const File *ff,
void *tx,
const uint64_t tx_id, uint8_t dir,
OutputJsonCtx *eve_ctx)
229 void *tx,
const uint64_t tx_id, uint8_t dir)
243 static TmEcode JsonFileLogThreadInit(
ThreadVars *t,
const void *initdata,
void **data)
251 SCLogDebug(
"Error getting context for EveLogFile. \"initdata\" argument NULL");
286 static void OutputFileLogDeinitSub(
OutputCtx *output_ctx)
306 if (
unlikely(output_file_ctx == NULL))
325 SCLogConfig(
"forcing magic lookup for logged files");
333 if (output_file_ctx->
xff_cfg != NULL) {
340 output_file_ctx->
eve_ctx = ojc;
341 output_ctx->
data = output_file_ctx;
342 output_ctx->
DeInit = OutputFileLogDeinitSub;
345 result.
ctx = output_ctx;
354 OutputFileLogInitSub, JsonFileLogger, JsonFileLogThreadInit, JsonFileLogThreadDeinit);
struct SCJsonBuilder SCJsonBuilder
int SCConfValIsTrue(const char *val)
Check if a value is true.
void FileForceHashParseCfg(SCConfNode *conf)
Function to parse forced file hashing configuration.
SCJsonBuilder * JsonBuildFileInfoRecord(const Packet *p, const File *ff, void *tx, const uint64_t tx_id, const bool stored, uint8_t dir, HttpXFFCfg *xff_cfg, OutputJsonCtx *eve_ctx)
OutputJsonCommonSettings cfg
void HttpXFFGetCfg(SCConfNode *conf, HttpXFFCfg *result)
Function to return XFF configuration from a configuration node.
void FileForceTrackingEnable(void)
OutputJsonThreadCtx * ctx
void FreeEveThreadCtx(OutputJsonThreadCtx *ctx)
AppProto SCFlowGetAppProtocol(const Flow *f)
SCJsonBuilder * CreateEveHeader(const Packet *p, enum SCOutputJsonLogDirection dir, const char *event_type, JsonAddrInfo *addr, OutputJsonCtx *eve_ctx)
void JsonAddrInfoInit(const Packet *p, enum SCOutputJsonLogDirection dir, JsonAddrInfo *addr, OutputJsonCommonSettings *cfg)
const char * AppProtoToString(AppProto alproto)
Maps the ALPROTO_*, to its normalized string equivalent.
void JsonFileLogRegister(void)
OutputJsonThreadCtx * CreateEveThreadCtx(ThreadVars *t, OutputJsonCtx *ctx)
const JsonAddrInfo json_addr_info_zero
void FileForceMagicEnable(void)
void OutputJsonBuilderBuffer(ThreadVars *tv, const Packet *p, Flow *f, SCJsonBuilder *js, OutputJsonThreadCtx *ctx)
const char * SCConfNodeLookupChildValue(const SCConfNode *node, const char *name)
Lookup the value of a child configuration node by name.
void OutputRegisterFileSubModule(LoggerId id, const char *parent_name, const char *name, const char *conf_name, OutputInitSubFunc InitFunc, SCFileLogger FileLogFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit)
Register a file output sub-module.
bool EveHttpAddMetadata(const Flow *f, uint64_t tx_id, SCJsonBuilder *js)
bool EveSMBAddMetadata(const Flow *f, uint64_t tx_id, SCJsonBuilder *jb)
size_t strlcpy(char *dst, const char *src, size_t siz)
bool EveSMTPAddMetadata(const Flow *f, uint64_t tx_id, SCJsonBuilder *js)
bool EveNFSAddMetadata(const Flow *f, uint64_t tx_id, SCJsonBuilder *jb)
Per thread variable structure.
bool EveNFSAddMetadataRPC(const Flow *f, uint64_t tx_id, SCJsonBuilder *jb)
EveJsonSimpleAppLayerLogger * SCEveJsonSimpleGetLogger(AppProto alproto)
void EveFileInfo(SCJsonBuilder *jb, const File *ff, const uint64_t tx_id, const uint16_t flags)
#define FLOW_PKT_TOCLIENT
void * AppLayerParserGetTx(uint8_t ipproto, AppProto alproto, void *alstate, uint64_t tx_id)
SCConfNode * SCConfNodeLookupChild(const SCConfNode *node, const char *name)
Lookup a child configuration node by name.
bool EveEmailAddMetadata(const Flow *f, uint64_t tx_id, SCJsonBuilder *js)
void FileForceFilestoreEnable(void)
void(* DeInit)(struct OutputCtx_ *)
EveJsonSimpleTxLogFunc LogTx
struct SCLogConfig_ SCLogConfig
Holds the config state used by the logging api.
char src_ip[JSON_ADDR_LEN]
char dst_ip[JSON_ADDR_LEN]
struct JsonFileLogThread_ JsonFileLogThread
int HttpXFFGetIPFromTx(const Flow *f, uint64_t tx_id, HttpXFFCfg *xff_cfg, char *dstbuf, int dstbuflen)
Function to return XFF IP if any in the selected transaction. The caller needs to lock the flow.
AppProto alproto
application level protocol
struct OutputFileCtx_ OutputFileCtx
OutputFileCtx * filelog_ctx
#define DEBUG_VALIDATE_BUG_ON(exp)
HttpXFFCfg * parent_xff_cfg