TAILQ_ENTRY(PcapFileName_) next; /**< Pointer to next Pcap File for tailq. */
} PcapFileName;
+thread_local char *pcap_file_thread = NULL;
+
typedef struct PcapLogProfileData_ {
uint64_t total;
uint64_t cnt;
#endif /* INIT_RING_BUFFER */
}
+ if (pl->mode == LOGMODE_MULTI) {
+ PcapLogOpenFileCtx(td->pcap_log);
+ } else {
+ if (pl->filename == NULL) {
+ PcapLogOpenFileCtx(pl);
+ }
+ }
+
return TM_ECODE_OK;
}
SCLogDebug("Opening pcap file log %s", pf->filename);
TAILQ_INSERT_TAIL(&pl->pcap_file_list, pf, next);
+ if (pl->mode == LOGMODE_MULTI || pl->mode == LOGMODE_NORMAL) {
+ pcap_file_thread = pl->filename;
+ }
PCAPLOG_PROFILE_END(pl->profile_open);
return 0;
return -1;
}
+char *PcapLogGetFilename(void)
+{
+ /* return pcap filename per thread */
+ if (pcap_file_thread != NULL) {
+ return pcap_file_thread;
+ }
+ return NULL;
+}
+
static int profiling_pcaplog_enabled = 0;
static int profiling_pcaplog_output_to_file = 0;
static char *profiling_pcaplog_file_name = NULL;
void PcapLogRegister(void);
void PcapLogProfileSetup(void);
+char *PcapLogGetFilename(void);
#endif /* __LOG_PCAP_H__ */
#include "util-classification-config.h"
#include "util-syslog.h"
#include "util-logopenfile.h"
+#include "log-pcap.h"
#include "output.h"
#include "output-json.h"
EvePacket(p, jb, 0);
}
+ char *pcap_filename = PcapLogGetFilename();
+ if (pcap_filename != NULL) {
+ jb_set_string(jb, "capture_file", pcap_filename);
+ }
+
OutputJsonBuilderBuffer(jb, aft->ctx);
jb_free(jb);
}