Go to the documentation of this file.
54 static JsonBuilder *CreateEveHeaderFromFlow(
const Flow *f)
57 char srcip[46] = {0}, dstip[46] = {0};
60 JsonBuilder *jb = jb_new_object();
71 PrintInet(AF_INET, (
const void *)&(f->
src.addr_data32[0]), srcip,
sizeof(srcip));
72 PrintInet(AF_INET, (
const void *)&(f->
dst.addr_data32[0]), dstip,
sizeof(dstip));
81 PrintInet(AF_INET, (
const void *)&(f->
dst.addr_data32[0]), srcip,
sizeof(srcip));
82 PrintInet(AF_INET, (
const void *)&(f->
src.addr_data32[0]), dstip,
sizeof(dstip));
92 jb_set_string(jb,
"timestamp", timebuf);
99 json_object_set_new(js,
"sensor_id", json_integer(sensor_id));
104 jb_set_string(jb,
"in_iface", f->
livedev->
dev);
111 jb_open_array(jb,
"vlan");
112 jb_append_uint(jb, f->
vlan_id[0]);
114 jb_append_uint(jb, f->
vlan_id[1]);
117 jb_append_uint(jb, f->
vlan_id[2]);
123 jb_set_string(jb,
"src_ip", srcip);
130 jb_set_uint(jb,
"src_port", sp);
133 jb_set_string(jb,
"dest_ip", dstip);
140 jb_set_uint(jb,
"dest_port", dp);
149 jb_set_string(jb,
"proto",
proto);
155 jb_set_uint(jb,
"icmp_type", f->
icmp_s.type);
156 jb_set_uint(jb,
"icmp_code", f->
icmp_s.code);
158 jb_set_uint(jb,
"response_icmp_type", f->
icmp_d.type);
159 jb_set_uint(jb,
"response_icmp_code", f->
icmp_d.code);
163 jb_set_uint(jb,
"spi", f->
esp.spi);
184 jb_set_string(js,
"app_proto_expected",
199 jb_open_object(js,
"bypassed");
214 jb_set_string(js,
"start", timebuf1);
221 jb_open_object(jb,
"flow");
226 jb_set_string(jb,
"end", timebuf2);
229 jb_set_uint(jb,
"age", age);
235 switch (flow_state) {
249 #ifdef CAPTURE_OFFLOAD
250 case FLOW_STATE_CAPTURE_BYPASSED:
257 SCLogDebug(
"invalid flow state: %d, contact developers", flow_state);
260 const char *reason = NULL;
270 jb_set_string(jb,
"reason", reason);
288 if (f->
proto == IPPROTO_TCP) {
289 jb_open_object(jb,
"tcp");
294 snprintf(hexflags,
sizeof(hexflags),
"%02x",
296 jb_set_string(jb,
"tcp_flags", hexflags);
298 snprintf(hexflags,
sizeof(hexflags),
"%02x",
300 jb_set_string(jb,
"tcp_flags_ts", hexflags);
302 snprintf(hexflags,
sizeof(hexflags),
"%02x",
304 jb_set_string(jb,
"tcp_flags_tc", hexflags);
310 if (tcp_state != NULL)
311 jb_set_string(jb,
"state", tcp_state);
339 MemBufferReset(thread->
buffer);
341 JsonBuilder *jb = CreateEveHeaderFromFlow(f);
346 EveFlowLogJSON(thread, jb, f);
OutputInitResult OutputJsonLogInitSub(ConfNode *conf, OutputCtx *parent_ctx)
void CreateIsoTimeString(const SCTime_t ts, char *str, size_t size)
OutputJsonCommonSettings cfg
FlowStorageId GetFlowBypassInfoID(void)
TmEcode JsonLogThreadInit(ThreadVars *t, const void *initdata, void **data)
const char * AppProtoToString(AppProto alproto)
Maps the ALPROTO_*, to its string equivalent.
void OutputJsonBuilderBuffer(ThreadVars *tv, const Packet *p, Flow *f, JsonBuilder *js, OutputJsonThreadCtx *ctx)
bool SCProtoNameValid(uint16_t proto)
Function to check if the received protocol number is valid and do we have corresponding name entry fo...
struct Flow_::@116::@122 icmp_d
const char * known_proto[256]
struct Flow_::@114::@120 icmp_s
void JsonFlowLogRegister(void)
void OutputRegisterFlowSubModule(LoggerId id, const char *parent_name, const char *name, const char *conf_name, OutputInitSubFunc InitFunc, FlowLogger FlowLogFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit)
Register a flow output sub-module.
struct Flow_::@114::@121 esp
@ FLOW_STATE_LOCAL_BYPASSED
#define JB_SET_STRING(jb, key, val)
Per thread variable structure.
const char * PrintInet(int af, const void *src, char *dst, socklen_t size)
void EveAddCommonOptions(const OutputJsonCommonSettings *cfg, const Packet *p, const Flow *f, JsonBuilder *js, enum OutputJsonLogDirection dir)
void EveTcpFlags(const uint8_t flags, JsonBuilder *js)
jsonify tcp flags field Only add 'true' fields in an attempt to keep things reasonably compact.
#define FLOW_WRONG_THREAD
#define JB_SET_TRUE(jb, key)
#define FLOW_END_FLAG_EMERGENCY
#define STREAMTCP_STREAM_FLAG_HAS_GAP
void * FlowGetStorageById(const Flow *f, FlowStorageId id)
void EveAddAppProto(Flow *f, JsonBuilder *js)
struct LiveDevice_ * livedev
void CreateEveFlowId(JsonBuilder *js, const Flow *f)
#define FLOW_END_FLAG_SHUTDOWN
const char * StreamTcpStateAsString(const enum TcpState state)
uint16_t vlan_id[VLAN_MAX_LAYERS]
int FlowHasAlerts(const Flow *f)
Check if flow has alerts.
#define FLOW_END_FLAG_TIMEOUT
TmEcode JsonLogThreadDeinit(ThreadVars *t, void *data)
AppProto alproto
application level protocol
#define FLOW_END_FLAG_FORCED
#define FLOW_DIR_REVERSED
#define DEBUG_VALIDATE_BUG_ON(exp)
union FlowAddress_::@113 address
void EveAddFlow(Flow *f, JsonBuilder *js)